Exemplo n.º 1
0
        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");
        }
Exemplo n.º 2
0
        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");
        }
Exemplo n.º 3
0
        public void VerifyThatPassesIfMatcherMatchesValue()
        {
            object value = new NamedObject("value");

            Verify.That(value, Is.Same(value));
        }