public void VerifyThatFailsIfMatcherDoesNotMatchValue() { object expected = new NamedObject("expected"); object actual = new NamedObject("actual"); Matcher matcher = Is.Same(expected); try { Verify.That(actual, matcher); } catch (ExpectationException e) { Assert.AreEqual( Environment.NewLine + "Expected: " + matcher + Environment.NewLine + "Actual: <" + actual + ">", e.Message); return; } Assert.Fail("Verify.That should have failed"); }
public void CanPrependCustomMessageToDescriptionOfFailure() { object expected = new NamedObject("expected"); object actual = new NamedObject("actual"); Matcher matcher = Is.Same(expected); try { Verify.That(actual, matcher, "message {0} {1}", "0", 1); } catch (ExpectationException e) { Assert.AreEqual( "message 0 1" + Environment.NewLine + "Expected: " + matcher + Environment.NewLine + "Actual: <" + actual + ">", e.Message); return; } Assert.Fail("Verify.That should have failed"); }
public void VerifyThatPassesIfMatcherMatchesValue() { object value = new NamedObject("value"); Verify.That(value, Is.Same(value)); }