public CastProvider(ITestMatcher <T> real) { _real = real; // Don't be reentrant with the cast provider type itself Debug.Assert(!_real.GetType().Name.Contains("CastProvider")); }
public CaptureProvider(ITestMatcher <Exception> real) { _real = real; // Don't be reentrant with the provider type itself Debug.Assert(!_real.GetType().Name.Contains("CaptureProvider")); }
public ItemsProvider(ITestMatcher <IEnumerable <object> > real) { _real = real; // Don't be reentrant with the cast provider type itself Debug.Assert(!_real.GetType().Name.Contains("ItemsProvider")); }
public PropertyProvider(PropertyCommand <T, TProperty> parent, ITestMatcher <TProperty> real) { _parent = parent; _real = real; // Don't be reentrant with the cast provider type itself Debug.Assert(!_real.GetType().Name.Contains("PropertyProvider")); }
public bool Matches(ITestActualEvaluation <TFrom> actualFactory) { var real = TestMatcherName.FromType(_real.GetType()); Func <T> thunk = () => { try { var actual = actualFactory.Value; return((T)(object)actual); } catch (InvalidCastException e) { throw SpecFailure.CastRequiredByMatcherFailure(e, real); } }; return(_real.Matches(TestActual.Of(thunk))); }
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))); }