/// <summary> /// Test that two objects are not equal and raise an exception if the result is false /// </summary> /// <param name="notexpected">expected object. Can be a string, number, array...</param> /// <param name="input">current object. Can be a string, number, array...</param> /// <param name="failmessage"></param> public static void NotEquals(Object notexpected, Object input, string failmessage = null) { if (ObjExt.AreEqual(notexpected, input)) { throw new AssertFailure(failmessage, "expected!={0}\nwas={1}", notexpected, input); } }
private static string format(string message, string template, object arg1, object arg2) { if (message == null) { message = string.Format(template, ObjExt.ToStrings(arg1), ObjExt.ToStrings(arg2)); } return((MSG_KO + ' ' + message).TrimEnd()); }
public AssertFailure(string message, string template, object arg1, object arg2) { base.HResult = HRESULT; _message = message ?? string.Format(template , ObjExt.ToStrings(arg1), ObjExt.ToStrings(arg2)); }
/// <summary> /// Tests that two objects are not equal. /// </summary> /// <param name="expected">expected object. Can be a string, number, array...</param> /// <param name="input">current object. Can be a string, number, array...</param> /// <param name="failmessage">Message to return if the verification fails...</param> public static string NotEquals(object expected, object input, string failmessage = null) { return(!ObjExt.AreEqual(expected, input) ? MSG_OK : format(failmessage, "expected!={0} was={1}", expected, input)); }
public bool GenericTest <T>(T obj2) { return(ObjExt.GenericTest(obj2, obj2)); }