Example #1
0
 public static void IsTrue(bool condition, string message)
 {
     if (!condition)
     {
         Fail(AssertionMessageUtil.BooleanFailureMessage(true), message);
     }
 }
Example #2
0
 public static void IsNull(Object value, string message)
 {
     if (value != null)
     {
         Fail(AssertionMessageUtil.NullFailureMessage(value, true), message);
     }
 }
Example #3
0
 public static void IsNotNull(Object value, string message)
 {
     if (value == null)
     {
         Fail(AssertionMessageUtil.NullFailureMessage(null, false), message);
     }
 }
Example #4
0
 public static void IsFalse(bool condition, string message)
 {
     if (condition)
     {
         Fail(AssertionMessageUtil.BooleanFailureMessage(false), message);
     }
 }
Example #5
0
 public static void AreNotEqual(Object expected, Object actual, string message)
 {
     if (actual == expected)
     {
         Fail(AssertionMessageUtil.GetEqualityMessage(actual, expected, false), message);
     }
 }
Example #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);
     }
 }
Example #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);
     }
 }
Example #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);
 }