1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
- public static class AssertHelper
- {
- [Conditional("UNITY_ASSERTIONS")]
- public static void Implies(bool condition, bool result, string message = "")
- {
- if (condition)
- {
- }
- }
- [Conditional("UNITY_ASSERTIONS")]
- public static void Implies(bool condition, Func<bool> result, string message = "")
- {
- if (condition)
- {
- }
- }
- [Conditional("UNITY_ASSERTIONS")]
- public static void Implies(string conditionName, bool condition, string resultName, bool result)
- {
- }
- [Conditional("UNITY_ASSERTIONS")]
- public static void Implies(string conditionName, bool condition, string resultName, Func<bool> result)
- {
- if (condition)
- {
- }
- }
- [Conditional("UNITY_ASSERTIONS")]
- public static void Contains<T>(T value, IEnumerable<T> collection, string message = "")
- {
- if (!collection.Contains(value))
- {
- string str = "The value " + value + " was not found in the collection [";
- bool flag = true;
- foreach (T t in collection)
- {
- if (!flag)
- {
- str += ", ";
- flag = false;
- }
- str += t.ToString();
- }
- str = str + "]\n" + message;
- }
- }
- }
|