Ejemplo n.º 1
0
 public static void IsTrue(bool condition, string message)
 {
     if (!condition)
     {
         Fail(AssertionMessageUtil.BooleanFailureMessage(true), message);
     }
 }
Ejemplo n.º 2
0
 public static void IsNull(Object value, string message)
 {
     if (value != null)
     {
         Fail(AssertionMessageUtil.NullFailureMessage(value, true), message);
     }
 }
Ejemplo n.º 3
0
 public static void IsNotNull(Object value, string message)
 {
     if (value == null)
     {
         Fail(AssertionMessageUtil.NullFailureMessage(null, false), message);
     }
 }
Ejemplo n.º 4
0
 public static void IsFalse(bool condition, string message)
 {
     if (condition)
     {
         Fail(AssertionMessageUtil.BooleanFailureMessage(false), message);
     }
 }
Ejemplo n.º 5
0
 public static void AreNotEqual(Object expected, Object actual, string message)
 {
     if (actual == expected)
     {
         Fail(AssertionMessageUtil.GetEqualityMessage(actual, expected, false), message);
     }
 }
Ejemplo n.º 6
0
 public static void AreEqual <T>(T expected, T actual, string message, IEqualityComparer <T> comparer)
 {
     if (typeof(Object).IsAssignableFrom(typeof(T)))
     {
         AreEqual((object)expected as Object, (object)actual as Object, message);
         return;
     }
     if (!comparer.Equals(actual, expected))
     {
         Fail(AssertionMessageUtil.GetEqualityMessage(actual, expected, true), message);
     }
 }
Ejemplo n.º 7
0
 public static void IsNull <T>(T value, string message)
     where T : class
 {
     if (typeof(Object).IsAssignableFrom(typeof(T)))
     {
         IsNull((object)value as Object, message);
     }
     else if (value != null)
     {
         Fail(AssertionMessageUtil.NullFailureMessage(value, true), message);
     }
 }
Ejemplo n.º 8
0
 public static void ExceptionExpected(Type exceptionType, Action action, string message = "")
 {
     try
     {
         action();
     }
     catch (Exception e)
     {
         if (exceptionType != e.GetType())
         {
             Fail(AssertionMessageUtil.GetMessage("Expected exception of type " + exceptionType.FullName + " got " + e.GetType().FullName), message);
         }
         return;
     }
     Fail(AssertionMessageUtil.GetMessage("Expected exception of type " + exceptionType.FullName), message);
 }