public override ExpectationResult Verify(T value, IValueFormattingService formattingService) { if (!_expectation.Verify(value, formattingService)) { return(ExpectationResult.Success); } return(FormatFailure(formattingService, "it was")); }
public override ExpectationResult Verify(TBase value, IValueFormattingService formattingService) { if (value == null || value is TDerived) { return(_expectation.Verify((TDerived)value, formattingService)); } return(ExpectationResult.Failure($"value of type '{value.GetType().Name}' cannot be cast to '{typeof(TDerived).Name}'")); }
public override ExpectationResult Verify(IEnumerable <TValue> collection, IValueFormattingService formattingService) { List <string> errors = new List <string>(); int i = 0; foreach (var item in collection ?? Enumerable.Empty <TValue>()) { var result = _itemExpectation.Verify(item, formattingService); if (result) { return(ExpectationResult.Success); } errors.Add($"[{i++}]: {result.Message}"); } return(FormatFailure(formattingService, $"got: '{formattingService.FormatValue(collection)}'", errors)); }