示例#1
0
 public override string ToString()
 {
     return(ArgumentFormatter.Format(this.value));
 }
示例#2
0
        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()));
        }
示例#3
0
 public static void WithThrowingPropertyGetter()
 {
     Assert.Equal("ThrowingGetter { MyThrowingProperty = (throws NotImplementedException) }", ArgumentFormatter.Format(new ThrowingGetter()));
 }
示例#4
0
        public static void Flags(FlagsEnum enumValue, string expected)
        {
            var actual = ArgumentFormatter.Format(enumValue);

            Assert.Equal(expected, actual);
        }
示例#5
0
 public static void OnlyFirstFewValuesOfEnumerableAreRendered()
 {
     Assert.Equal("[0, 1, 2, 3, 4, ...]", ArgumentFormatter.Format(Enumerable.Range(0, int.MaxValue)));
 }
示例#6
0
 public static void CharacterValue(char value, string expected)
 {
     Assert.Equal(expected, ArgumentFormatter.Format(value));
 }
示例#7
0
 public static void NullValue()
 {
     Assert.Equal("null", ArgumentFormatter.Format(null));
 }
示例#8
0
        public static void FloatValue()
        {
            var floatPI = (float)Math.PI;

            Assert.Equal(floatPI.ToString("G9"), ArgumentFormatter.Format(floatPI));
        }
示例#9
0
 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));
 }
示例#12
0
 public static void TypeValue()
 {
     Assert.Equal("typeof(System.String)", ArgumentFormatter.Format(typeof(string)));
 }
示例#13
0
        public static void DateTimeValue()
        {
            var now = DateTime.UtcNow;

            Assert.Equal <object>(now.ToString("o"), ArgumentFormatter.Format(now));
        }
示例#14
0
 public static void CharacterValue()
 {
     Assert.Equal("'a'", ArgumentFormatter.Format('a'));
 }
示例#15
0
 public static void WhenCustomTypeImplementsToString_UsesToString()
 {
     Assert.Equal("This is what you should show", ArgumentFormatter.Format(new TypeWithToString()));
 }
示例#16
0
 public static void StringValue()
 {
     Assert.Equal("\"Hello, world!\"", ArgumentFormatter.Format("Hello, world!"));
 }
示例#17
0
 public static void StringValue(string value, string expected)
 {
     Assert.Equal(expected, ArgumentFormatter.Format(value));
 }
示例#18
0
 public static void StringValueTruncated()
 {
     Assert.Equal("\"----|----1----|----2----|----3----|----4----|----5\"...", ArgumentFormatter.Format("----|----1----|----2----|----3----|----4----|----5-"));
 }
示例#19
0
 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));
 }
示例#21
0
        public static void DateTimeOffsetValue()
        {
            var now = DateTimeOffset.UtcNow;

            Assert.Equal(now.ToString("o"), ArgumentFormatter.Format(now));
        }
示例#22
0
 public override string ToString() => ArgumentFormatter.Format(this.Value);
示例#23
0
        public static void EnumerableValue()
        {
            var expected = $"[1, {2.3M}, \"Hello, world!\"]";

            Assert.Equal(expected, ArgumentFormatter.Format(new object[] { 1, 2.3M, "Hello, world!" }));
        }
示例#24
0
 public static void TypeValue(Type type, string expected)
 {
     Assert.Equal(expected, ArgumentFormatter.Format(type));
 }
示例#25
0
        public static void ReturnsValuesInAlphabeticalOrder()
        {
            var expected = $"MyComplexType {{ MyPublicField = 42, MyPublicProperty = {21.12M} }}";

            Assert.Equal(expected, ArgumentFormatter.Format(new MyComplexType()));
        }
示例#26
0
        public static void FlagsWithCulture()
        {
            var actual = ArgumentFormatter.Format(FlagsEnum.Value1 | FlagsEnum.Value2);

            Assert.Equal("Value1 | Value2", actual);
        }
示例#27
0
 public static void Empty()
 {
     Assert.Equal("Object { }", ArgumentFormatter.Format(new object()));
 }
示例#28
0
 public static void TypesAreRenderedWithMaximumDepthToPreventInfiniteRecursion()
 {
     Assert.Equal("Looping { Me = Looping { Me = Looping { ... } } }", ArgumentFormatter.Format(new Looping()));
 }
示例#29
0
        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()));
        }
示例#30
0
 private IEnumerable <string> FormatArgs(object[] arguments)
 {
     return(arguments.Select(x => _argFormatter.Format(x, false)));
 }