예제 #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());
        }