Beispiel #1
0
            protected override TestFailure ShouldCore(IEnumerable <object> items, ITestMatcher <object> baseMatcher)
            {
                var tally = Tally.New(items,
                                      Matchers.Not(baseMatcher),
                                      t => (t.Failures == 5),
                                      TestMatcherLocalizer.FailurePredicate(baseMatcher));

                return(tally.Lift("notAny", SR.ExpectedNotAnyElementTo()));
            }
Beispiel #2
0
            protected override TestFailure ShouldCore(IEnumerable <object> items, ITestMatcher <object> baseMatcher)
            {
                var tally = Tally.New(items,
                                      Matchers.Not(baseMatcher),
                                      t => (t.Successes > 0),
                                      TestMatcherLocalizer.FailurePredicate(baseMatcher));

                if (tally.Successes > 0)
                {
                    return(null);
                }
                return(tally.Lift("notAll", SR.ExpectedNotAllElementsTo()));
            }
Beispiel #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);
            }
Beispiel #4
0
 internal void NotThat <T>(T actual, ITestMatcher <T> matcher, string message = null, params object[] args)
 {
     That(actual, Matchers.Not(matcher), message, (object[])args);
 }
Beispiel #5
0
 ITestMatcher <object> ITestMatcherFactory <object> .CreateMatcher(TestContext testContext)
 {
     return(Matchers.Not(Matchers.BeNull()));
 }