public void AreEqual_String_Fail() { MockAssertResultHandler mockAssert = new MockAssertResultHandler(); ServiceLocator.AssertResultHandler = mockAssert; MWTAssert.AreEqual("foo", "FOO", false, "This is a message '{0}'.", "foo"); UnitTestAssert.AreEqual("This is a message 'foo'.", mockAssert.LastMessage); }
public void AreEqual_String_PassIfIgnoreCase() { MockAssertResultHandler mockAssert = new MockAssertResultHandler(); ServiceLocator.AssertResultHandler = mockAssert; MWTAssert.AreEqual("foo", "FOO", true, "Error Message"); UnitTestAssert.AreEqual("Assert.AreEqual: Expected <foo>", mockAssert.LastMessage); }
public void AreEqual_Integers_Fail() { MockAssertResultHandler mockAssert = new MockAssertResultHandler(); ServiceLocator.AssertResultHandler = mockAssert; MWTAssert.AreEqual(1, 2, "This is a message '{0}'.", "foo"); UnitTestAssert.AreEqual("This is a message 'foo'.", mockAssert.LastMessage); }
public void AreEqual_Object_Pass() { MockAssertResultHandler mockAssert = new MockAssertResultHandler(); ServiceLocator.AssertResultHandler = mockAssert; object o1 = new List <string>(); MWTAssert.AreEqual(o1, o1, "Error Message"); UnitTestAssert.AreEqual("Assert.AreEqual<System.Object>: Expected <System.Collections.Generic.List`1[System.String]>", mockAssert.LastMessage); }
public void AreEqual_PassWithMessage() { MockAssertResultHandler mockAssert = new MockAssertResultHandler(); ServiceLocator.AssertResultHandler = mockAssert; MWTAssert.AreEqual("foo", "foo", "Error Message"); UnitTestAssert.AreEqual("Assert.AreEqual<System.String>: Expected <foo>", mockAssert.LastMessage); MWTAssert.AreEqual(1, 1, "Error Message"); UnitTestAssert.AreEqual("Assert.AreEqual<System.Int32>: Expected <1>", mockAssert.LastMessage); }
public void AreEqual_VerifyErrorMessageWhenStringsAreNotEqualThirdCharacter() { MockAssertResultHandler mockAssert = new MockAssertResultHandler(); ServiceLocator.AssertResultHandler = mockAssert; MWTAssert.AreEqual("String one", "StAing two"); UnitTestAssert.AreEqual( @"Assert.AreEqual<System.String>: strings are not equal. Strings differ at index 2. Expected char 'r', got char 'A'. Expected: <""String one""> Actual: <""StAing two"">", mockAssert.LastMessage); }
public void AreEqual_ErrorIsStringsAreNotEqual() { ServiceLocator.AssertResultHandler = null; MWTAssert.AreEqual("Test string1", "Test string2"); }
public void AreEqual_NoErrorIfStringsAreEqual() { ServiceLocator.AssertResultHandler = null; MWTAssert.AreEqual("Foo bar! Whee!", "Foo bar! Whee!"); }