public bool Matches(ITestActualEvaluation <T> actualFactory) { var myParent = _parent; return(_real.Matches( Actual = TestActual.Of(() => myParent._accessor(actualFactory.Value)) )); }
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))); }
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); }