public EnumerableDisplayActual(IEnumerable enumerableValue, int depth) { foreach (object valueObject in enumerableValue) { _values.Add(DisplayActual.Create(valueObject, depth)); } _type = enumerableValue.GetType(); }
public DefaultDisplayActual(object value, int depth, ObjectIDGenerator graph) { _schema = DisplayActualSchema.Create(value.GetType()); depth += 1; foreach (var accessor in _schema.Accessors) { IDisplayActual pv; try { pv = DisplayActual.Create(DisplayActual.Create(accessor.GetValue(value), depth, graph)); } catch (Exception ex) { ex = Record.UnwindTargetException(ex); pv = DisplayActual.Create($"<{ex.GetType().Name}>"); } _entries.Add( (accessor.Name, pv) ); } }
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); }
internal static string ConvertToString(object value) { return(DisplayActual.Create(value).Format(DisplayActualOptions.None)); }