Exemple #1
0
        public void For_unwinds_support_test_matcher()
        {
            var wrapped = TestMatcher.UnitWrapper(new ThrowsMatcher());

            Assert.Equal(
                "spec.throws", TestMatcherName.For(wrapped).Name
                );
        }
Exemple #2
0
        public void For_unwinds_negation_support_test_matcher()
        {
            var wrapped = Matchers.Not(Matchers.BeEmpty());

            Assert.Equal(
                "spec.empty.not", TestMatcherName.For(wrapped).Name
                );
        }
Exemple #3
0
        public void For_supports_the_invariant_matchers()
        {
            Assert.Equal(
                "spec.nothing",
                TestMatcherName.For(TestMatcher.Nothing).Name
                );

            Assert.Equal(
                "spec.anything",
                TestMatcherName.For(TestMatcher.Anything).Name
                );
        }
Exemple #4
0
        public void For_supports_the_And_and_Or_matchers()
        {
            Assert.Equal(
                "spec.and",
                TestMatcherName.For(Matchers.And(Matchers.BeEmpty(), Matchers.BeEmpty())).Name
                );

            Assert.Equal(
                "spec.or",
                TestMatcherName.For(Matchers.Or(Matchers.BeEmpty(), Matchers.BeEmpty())).Name
                );
        }
        static TestFailure FailureMessageCore(object matcher, bool predicate)
        {
            var matcherName = TestMatcherName.For(matcher);

            if (predicate)
            {
                matcherName = matcherName.Predicate();
            }

            // We use the actual matcher to get the user data for the failure
            var failure = new TestFailure(matcherName, ActualMatcher(matcher));

            string message = ExpectedMessage(matcherName, failure.UserData);

            failure.Message = message;
            ChildrenMessages(failure, matcher);
            return(failure);
        }