Esempio n. 1
0
        private bool InternalTryMatch(Object actual, IMatcher childMatcher, ISelfDescribing selfDescribing)
        {
            //so we can print child diagnostics after
            var childDiag = new MatchDiagnostics();
            var matched   = childMatcher.Matches(actual, childDiag);

            Text(matched ? "Match":"Mismatch!");

            var desc = Description.With();

            if (selfDescribing != null)
            {
                desc.Value(selfDescribing);
            }
            if (!matched)
            {
                Expect.PrintExpectButGot(desc, actual, childMatcher);
                desc.Value(childDiag);
            }
            else
            {
                desc.Value(childMatcher);
            }
            Child(desc);
            return(matched);
        }
Esempio n. 2
0
        private void GenerateAndThrowFailMsg(Object actual, IMatcher matcher, MatchDiagnostics diag, Object label)
        {
            var desc = new Description();

            if (label != null)
            {
                desc.Child("for", label);
            }
            Expect.PrintExpectButGot(desc, actual, matcher);
            desc.Text("==== Diagnostics ====");
            desc.Child(diag);
            TestFirstAssert.Fail(Environment.NewLine + desc.ToString());
        }