public override string ToString() { return(ArgumentFormatter.Format(this.value)); }
public static void ComplexTypeInsideComplexType() { var expected = $"MyComplexTypeWrapper {{ c = 'A', s = \"Hello, world!\", t = MyComplexType {{ MyPublicField = 42, MyPublicProperty = {21.12M} }} }}"; Assert.Equal(expected, ArgumentFormatter.Format(new MyComplexTypeWrapper())); }
public static void WithThrowingPropertyGetter() { Assert.Equal("ThrowingGetter { MyThrowingProperty = (throws NotImplementedException) }", ArgumentFormatter.Format(new ThrowingGetter())); }
public static void Flags(FlagsEnum enumValue, string expected) { var actual = ArgumentFormatter.Format(enumValue); Assert.Equal(expected, actual); }
public static void OnlyFirstFewValuesOfEnumerableAreRendered() { Assert.Equal("[0, 1, 2, 3, 4, ...]", ArgumentFormatter.Format(Enumerable.Range(0, int.MaxValue))); }
public static void CharacterValue(char value, string expected) { Assert.Equal(expected, ArgumentFormatter.Format(value)); }
public static void NullValue() { Assert.Equal("null", ArgumentFormatter.Format(null)); }
public static void FloatValue() { var floatPI = (float)Math.PI; Assert.Equal(floatPI.ToString("G9"), ArgumentFormatter.Format(floatPI)); }
public static void DoubleValue() { Assert.Equal(Math.PI.ToString("G17"), ArgumentFormatter.Format(Math.PI)); }
public override string ToString() => DefaultArgumentFormatter.Format(allFailures, false);
public void ArgumentFormatterFormatTypeNames(Type type, string expectedResult) { Assert.Equal(expectedResult, ArgumentFormatter.Format(type)); }
public static void TypeValue() { Assert.Equal("typeof(System.String)", ArgumentFormatter.Format(typeof(string))); }
public static void DateTimeValue() { var now = DateTime.UtcNow; Assert.Equal <object>(now.ToString("o"), ArgumentFormatter.Format(now)); }
public static void CharacterValue() { Assert.Equal("'a'", ArgumentFormatter.Format('a')); }
public static void WhenCustomTypeImplementsToString_UsesToString() { Assert.Equal("This is what you should show", ArgumentFormatter.Format(new TypeWithToString())); }
public static void StringValue() { Assert.Equal("\"Hello, world!\"", ArgumentFormatter.Format("Hello, world!")); }
public static void StringValue(string value, string expected) { Assert.Equal(expected, ArgumentFormatter.Format(value)); }
public static void StringValueTruncated() { Assert.Equal("\"----|----1----|----2----|----3----|----4----|----5\"...", ArgumentFormatter.Format("----|----1----|----2----|----3----|----4----|----5-")); }
public static void DecimalValue() { Assert.Equal(123.45M.ToString(), ArgumentFormatter.Format(123.45M)); }
/// <summary> /// Returns a string representation of the base expected value. /// </summary> /// <returns></returns> public override string ToString() { return(DefaultArgumentFormatter.Format(_value, false)); }
public static void DateTimeOffsetValue() { var now = DateTimeOffset.UtcNow; Assert.Equal(now.ToString("o"), ArgumentFormatter.Format(now)); }
public override string ToString() => ArgumentFormatter.Format(this.Value);
public static void EnumerableValue() { var expected = $"[1, {2.3M}, \"Hello, world!\"]"; Assert.Equal(expected, ArgumentFormatter.Format(new object[] { 1, 2.3M, "Hello, world!" })); }
public static void TypeValue(Type type, string expected) { Assert.Equal(expected, ArgumentFormatter.Format(type)); }
public static void ReturnsValuesInAlphabeticalOrder() { var expected = $"MyComplexType {{ MyPublicField = 42, MyPublicProperty = {21.12M} }}"; Assert.Equal(expected, ArgumentFormatter.Format(new MyComplexType())); }
public static void FlagsWithCulture() { var actual = ArgumentFormatter.Format(FlagsEnum.Value1 | FlagsEnum.Value2); Assert.Equal("Value1 | Value2", actual); }
public static void Empty() { Assert.Equal("Object { }", ArgumentFormatter.Format(new object())); }
public static void TypesAreRenderedWithMaximumDepthToPreventInfiniteRecursion() { Assert.Equal("Looping { Me = Looping { Me = Looping { ... } } }", ArgumentFormatter.Format(new Looping())); }
public static void LimitsOutputToFirstFewValues() { var expected = $@"Big {{ MyField1 = 42, MyField2 = ""Hello, world!"", MyProp1 = {21.12}, MyProp2 = typeof(ArgumentFormatterTests+ComplexTypes+Big), MyProp3 = 2014-04-17T07:45:23.0000000+00:00, ... }}"; Assert.Equal(expected, ArgumentFormatter.Format(new Big())); }
private IEnumerable <string> FormatArgs(object[] arguments) { return(arguments.Select(x => _argFormatter.Format(x, false))); }