Пример #1
0
        public void InspectionFormatter_Formats_Class()
        {
            var formatter = new InspectionFormatter(new ReferenceTest());

            Assert.AreEqual(@"ReferenceTest {
  Pointer: null }", formatter.ToString());
        }
Пример #2
0
        public void InspectionFormatter_Formats_DictionaryEmpty()
        {
            var dictionary = new Dictionary <char, string>();
            var formatter  = new InspectionFormatter(dictionary);

            Assert.AreEqual("Dictionary<Char, String> {}", formatter.ToString());
        }
Пример #3
0
        public void InspectionFormatter_Formats_ExtendedDictionaryEmpty()
        {
            var dictionary = new ExtendedDictionaryTest();
            var formatter  = new InspectionFormatter(dictionary);

            Assert.AreEqual(@"ExtendedDictionaryTest [Dictionary] {}", formatter.ToString());
        }
Пример #4
0
        public void InspectionFormatter_Formats_ClassReference()
        {
            var data = new ReferenceTest {
                Pointer = new ReferenceTest()
            };
            var formatter = new InspectionFormatter(data);

            Assert.AreEqual(@"ReferenceTest {
  Pointer: [ReferenceTest] }", formatter.ToString());
        }
Пример #5
0
        public void InspectionFormatter_Formats_ClassCircular()
        {
            var data = new ReferenceTest();

            data.Pointer = data;
            var formatter = new InspectionFormatter(data);

            Assert.AreEqual(@"ReferenceTest {
  Pointer: [Circular] }", formatter.ToString());
        }
Пример #6
0
        public void InspectionFormatter_Formats_ExtendedDictionaryPopulated()
        {
            var dictionary = new ExtendedDictionaryTest {
                { 1, 4 }, { 6, 12 }
            };
            var formatter = new InspectionFormatter(dictionary);

            Assert.AreEqual(@"ExtendedDictionaryTest [Dictionary] {
  1 => 4,
  6 => 12 }", formatter.ToString());
        }
Пример #7
0
        public void InspectionFormatter_Formats_DictionaryPopulated()
        {
            var dictionary = new Dictionary <char, string> {
                { 'a', "An amazing \"flute\"!" }, { 'b', "Boom!" }
            };
            var formatter = new InspectionFormatter(dictionary);

            Assert.AreEqual(@"Dictionary<Char, String> {
  'a' => ""An amazing \""flute\""!"",
  'b' => ""Boom!"" }", formatter.ToString());
        }
Пример #8
0
        public void InspectionFormatter_Formats_Struct()
        {
            var data = new TestStruct {
                Char = 'a', Code = 97
            };
            var formatter = new InspectionFormatter(data);

            Assert.AreEqual(@"TestStruct {
  Char: 'a',
  Code: 0x61 }", formatter.ToString());
        }
Пример #9
0
        public void InspectionFormatter_Formats_NoDepthStruct()
        {
            var data = new InnerTestStruct
            {
                Name = "LowerCaseCharacter", Identifier = IdentifierType.LowerCase,
                Data = new TestStruct {
                    Char = 'a', Code = 97
                }
            };
            var formatter = new InspectionFormatter(data);

            Assert.AreEqual(@"InnerTestStruct {
  Identifier: IdentifierType.LowerCase,
  Name: ""LowerCaseCharacter"",
  Data: [TestStruct] }", formatter.ToString());
        }
Пример #10
0
        public void InspectionFormatter_Formats_Double()
        {
            var formatter = new InspectionFormatter(0.123456D);

            Assert.AreEqual("0.123456D", formatter.ToString());
        }
Пример #11
0
        public void InspectionFormatter_Formats_Decimal()
        {
            var formatter = new InspectionFormatter(0.1234567891234M);

            Assert.AreEqual("0.1234567891234M", formatter.ToString());
        }
Пример #12
0
        public void InspectionFormatter_Formats_BoolFalse()
        {
            var formatter = new InspectionFormatter(false);

            Assert.AreEqual("false", formatter.ToString());
        }
Пример #13
0
        public void InspectionFormatter_Formats_SymbolChar()
        {
            var formatter = new InspectionFormatter('$');

            Assert.AreEqual("'$'", formatter.ToString());
        }
Пример #14
0
        public void InspectionFormatter_Formats_Type()
        {
            var formatter = new InspectionFormatter('a'.GetType());

            Assert.AreEqual("System.Char", formatter.ToString());
        }
Пример #15
0
        public void InspectionFormatter_Formats_ControlChar()
        {
            var formatter = new InspectionFormatter('\u0000');

            Assert.AreEqual("'\\u0000'", formatter.ToString());
        }
Пример #16
0
        public void InspectionFormatter_Formats_SignedBytePadded()
        {
            var formatter = new InspectionFormatter((sbyte)0x04);

            Assert.AreEqual("0x04", formatter.ToString());
        }
Пример #17
0
        public void InspectionFormatter_Formats_BasicString()
        {
            var formatter = new InspectionFormatter("Hello world");

            Assert.AreEqual(@"""Hello world""", formatter.ToString());
        }
Пример #18
0
        public void InspectionFormatter_Formats_LetterChar()
        {
            var formatter = new InspectionFormatter('a');

            Assert.AreEqual("'a'", formatter.ToString());
        }
Пример #19
0
        public void InspectionFormatter_Formats_DateTime()
        {
            var formatter = new InspectionFormatter(DateTime.Parse("2020-04-06T16:03:45.040Z"));

            Assert.AreEqual("2020-04-06T16:03:45.040Z", formatter.ToString());
        }
Пример #20
0
        public void InspectionFormatter_Formats_ArrayOfChars()
        {
            var formatter = new InspectionFormatter(new[] { 'a', 'ã‚¢', '$', '\u0000' });

            Assert.AreEqual("Char[4] { 'a', 'ã‚¢', '$', '\\u0000' }", formatter.ToString());
        }
Пример #21
0
        public void InspectionFormatter_Formats_ArrayOfInts()
        {
            var formatter = new InspectionFormatter(new[] { 4, 6, 3, 7 });

            Assert.AreEqual("Int32[4] { 4, 6, 3, 7 }", formatter.ToString());
        }
Пример #22
0
        public void InspectionFormatter_Formats_DelegateSingleArgument()
        {
            var formatter = new InspectionFormatter(new DelegateSingleArgument(name => name));

            Assert.AreEqual("DelegateSingleArgument(String name) => String", formatter.ToString());
        }
Пример #23
0
        public void InspectionFormatter_Formats_DelegateMultipleArguments()
        {
            var formatter = new InspectionFormatter(new DelegateMultipleArguments((a, b) => a + b));

            Assert.AreEqual("DelegateMultipleArguments(Int32 a, Int32 b) => Int32", formatter.ToString());
        }
Пример #24
0
        public void InspectionFormatter_Formats_Float()
        {
            var formatter = new InspectionFormatter(0.2f);

            Assert.AreEqual("0.2F", formatter.ToString());
        }
Пример #25
0
        public void InspectionFormatter_Formats_UnicodePart()
        {
            var formatter = new InspectionFormatter("😊"[0]);

            Assert.AreEqual("'\\uD83D'", formatter.ToString());
        }
Пример #26
0
        public void InspectionFormatter_Formats_TimeSpan()
        {
            var formatter = new InspectionFormatter(TimeSpan.FromMinutes(5));

            Assert.AreEqual("00:05:00", formatter.ToString());
        }
Пример #27
0
        public void InspectionFormatter_Formats_QuotedString()
        {
            var formatter = new InspectionFormatter(@"Hello ""world""");

            Assert.AreEqual(@"""Hello \""world\""""", formatter.ToString());
        }
Пример #28
0
        public void InspectionFormatter_Formats_EmptyStruct()
        {
            var formatter = new InspectionFormatter(new TestEmptyStruct());

            Assert.AreEqual("TestEmptyStruct {}", formatter.ToString());
        }
Пример #29
0
        public void InspectionFormatter_Formats_Byte()
        {
            var formatter = new InspectionFormatter((byte)0x14);

            Assert.AreEqual("0x14U", formatter.ToString());
        }
Пример #30
0
        public void InspectionFormatter_Formats_UnsignedLong()
        {
            var formatter = new InspectionFormatter(242043489611808769UL);

            Assert.AreEqual("242043489611808769UL", formatter.ToString());
        }