コード例 #1
0
                public bool Matches(ITestActualEvaluation <T> actualFactory)
                {
                    var myParent = _parent;

                    return(_real.Matches(
                               Actual = TestActual.Of(() => myParent._accessor(actualFactory.Value))
                               ));
                }
コード例 #2
0
                public bool Matches(ITestActualEvaluation <IEnumerable> actualFactory)
                {
                    // When the matcher can already handle the input, no need to apply
                    // adapter logic
                    if (_real is ITestMatcher <IEnumerable> fast)
                    {
                        return(fast.Matches(actualFactory));
                    }

                    var real = TestMatcherName.FromType(_real.GetType());
                    Func <IEnumerable <object> > thunk = () => (
                        actualFactory.Value.Cast <object>()
                        );

                    return(_real.Matches(TestActual.Of(thunk)));
                }
コード例 #3
0
            public override TestFailure Should(ITestMatcher <T> matcher)
            {
                var actual = TestActual.Of(_thunk);

                if (_negated)
                {
                    matcher = Matchers.Not(matcher);
                }
                if (matcher.Matches(actual))
                {
                    return(null);
                }

                var result = TestMatcherLocalizer.Failure(matcher, actual.Value)
                             .UpdateGiven(_given)
                             .UpdateBehavior(_behavior);

                if (matcher is ITestMatcher <Unit> m)
                {
                    result.UpdateActual(DisplayActual.Exception(actual.Exception));
                }
                return(result);
            }