public void AssertFailed_should_throw_argument_exception_if_assertionName_is_empty_string() { Assert.ThrowsException <ArgumentException>(() => { AssertHelper.AssertFailed(String.Empty, "test", "test"); }); }
public void AssertFailed_should_throw_argument_exception_if_assertionName_is_null() { Assert.ThrowsException <ArgumentNullException>(() => { AssertHelper.AssertFailed(null, "test", "test"); }); }
public void AssertFailed_should_create_assertion_failure() { const string ASSERTION_NAME = "TestAssertion"; const string MESSAGE = "TestMessage: {0}"; const string PARAM = "TestParam"; var exceptionCaught = false; try { AssertHelper.AssertFailed(ASSERTION_NAME, MESSAGE, PARAM); } catch (AssertFailedException afe) { exceptionCaught = true; Assert.IsTrue(afe.Message.Contains(ASSERTION_NAME)); Assert.IsTrue(afe.Message.Contains(String.Format(MESSAGE, PARAM))); } if (!exceptionCaught) { Assert.Fail("AssertFailed did not throw an exception as expected."); } }
public void AssertFailed_should_create_assertion_failure() { string assertionName = "TestAssertion"; string message = "TestMessage: {0}"; string param = "TestParam"; bool exceptionCaught = false; try { AssertHelper.AssertFailed(assertionName, message, param); } catch (AssertFailedException afe) { exceptionCaught = true; Assert.IsTrue(afe.Message.Contains(assertionName)); Assert.IsTrue(afe.Message.Contains(String.Format(message, param))); } if (!exceptionCaught) { Assert.Fail("AssertFailed did not throw an exception as expected."); } }
public void AssertFailed_should_throw_argument_exception_if_assertionName_is_null() { AssertHelper.AssertFailed(null, "test", "test"); }