Ejemplo n.º 1
0
 public override ExpectationResult Verify(T value, IValueFormattingService formattingService)
 {
     if (!_expectation.Verify(value, formattingService))
     {
         return(ExpectationResult.Success);
     }
     return(FormatFailure(formattingService, "it was"));
 }
Ejemplo n.º 2
0
        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}'"));
        }
Ejemplo n.º 3
0
        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));
        }