public void Dump_WithExtended_PrintsCorrect()
        {
            var col    = new DumpCollection(new string[] { "One", "Two", "Three" }, "Collection");
            var chrome = new RoundedChrome();

            Formatters.Chrome = chrome;
            var actual = col.ToString();

            ConsoleBase.WriteLineNoHeader(col.ToString());
            Formatters.Chrome = new BasicChrome();

            Assert.IsTrue(actual.Contains(chrome.BodyTopLeft) && actual.Contains(chrome.BodyLeft) && actual.Contains(chrome.BodyBottomLeft));
        }
        public void ToString_WithNoPadding_WithShortTypeNames_WithDictionary_WithObjects_Writes_Correct()
        {
            var underTest = new DumpCollection(new Dictionary <int, object>()
            {
                { 1, new TestObject1()
                  {
                      TestProperty1 = "Item1", TestProp2 = 2.22
                  } }
            });

            var expected = @"
Dictionary`2 (1 Item)
---------------------
| Key0   = 1
| Value0 = TestObject1 (2 Properties)
|          --------------------------
|          | TestProperty1 = ""Item1""
|          | TestProp2     = 2.22
|          --------------------------
---------------------
";

            var actual = "\r\n" + underTest.ToString(false);

            Assert.AreEqual(expected, actual);
        }
        public void ToString_WithNoPadding_WithShortTypeNames_WithDictionary_Writes_Correct()
        {
            var underTest = new DumpCollection(new Dictionary <object, object>()
            {
                { "Item1", "Entry1" },
                { 2, 2 },
                { "Double", 245.43 },
                { "EventArgs", EventArgs.Empty }
            });

            var expected = @"
Dictionary`2 (4 Items)
----------------------
| Key0   = ""Item1""
| Value0 = ""Entry1""
| Key1   = 2
| Value1 = 2
| Key2   = ""Double""
| Value2 = 245.43
| Key3   = ""EventArgs""
| Value3 = EventArgs (0 Properties)
----------------------
";

            var actual = "\r\n" + underTest.ToString(false);

            Assert.AreEqual(expected, actual);
        }
        public void ToString_WithNoPadding_WithShortTypeNames_WithList_RealObjects_Writes_Correct()
        {
            var underTest = new DumpCollection(new List <object>()
            {
                "Item1",
                2,
                245.43,
                new TestObject1()
                {
                    TestProperty1 = "Test Value 1", TestProp2 = 123.321
                }
            });
            var expected = @"
List`1 (4 Items)
----------------
| 0: ""Item1""
| 1: 2
| 2: 245.43
| 3: TestObject1 (2 Properties)
|    --------------------------
|    | TestProperty1 = ""Test Value 1""
|    | TestProp2     = 123.321
|    --------------------------
----------------
";

            var actual = "\r\n" + underTest.ToString(false);

            Assert.AreEqual(expected, actual);
        }
        public void ToString_WithNullValue_ShortNames_Prints_UnknownType()
        {
            IDictionary <object, object> dict = null;
            var underTest = new DumpCollection(dict);
            var expected  = @"
<unknown null collection> (0 Items)
-----------------------------------
-----------------------------------
";
            var actual    = "\r\n" + underTest.ToString(false);

            Assert.AreEqual(expected, actual);
        }
        public void ToString_WithNoPadding_WithShortTypeNames_WithEmptyEnumerable_Writes_Correct()
        {
            var underTest = new DumpCollection(new Object[0]);

            var expected = @"
Object[] (0 Items)
------------------
------------------
";

            var actual = "\r\n" + underTest.ToString(false);

            Assert.AreEqual(expected, actual);
        }
        public void ToString_WithNoPadding_WithShortTypeNames_WithEmptyDictionary_Writes_Correct()
        {
            var underTest = new DumpCollection(new Dictionary <object, object>()
            {
            });

            var expected = @"
Dictionary`2 (0 Items)
----------------------
----------------------
";

            var actual = "\r\n" + underTest.ToString(false);

            Assert.AreEqual(expected, actual);
        }
        public void ToString_WithNoPadding_WithShortTypeNames_WithList_WithName_Writes_Correct()
        {
            var underTest = new DumpCollection(new int[] { 1, 2, 3, 4 }, "ItemOne");
            var expected  = @"
ItemOne = Int32[] (4 Items)
          -----------------
          | 0: 1
          | 1: 2
          | 2: 3
          | 3: 4
          -----------------
";

            var actual = "\r\n" + underTest.ToString();

            Assert.AreEqual(expected, actual);
        }
        public void ToString_WithNoPadding_WithShortTypeNames_WithArray_Writes_Correct()
        {
            var underTest = new DumpCollection(new object[] { "Item1", 2, 245.43, EventArgs.Empty });
            var expected  = @"
Object[] (4 Items)
------------------
| 0: ""Item1""
| 1: 2
| 2: 245.43
| 3: EventArgs (0 Properties)
------------------
";

            var actual = "\r\n" + underTest.ToString(false);

            Assert.AreEqual(expected, actual);
        }
        public void ToString_WithNoPadding_WithShortTypeNames_CurrentLevelNegative_WithList_Writes_Correct()
        {
            var underTest = new DumpCollection(new List <object>()
            {
                "Item1", 2, 245.43, EventArgs.Empty
            });
            var expected = @"
List`1 (4 Items)
----------------
| 0: ""Item1""
| 1: 2
| 2: 245.43
| 3: EventArgs (0 Properties)
----------------
";

            var actual = "\r\n" + underTest.ToString(0, -1, false);

            Assert.AreEqual(expected, actual);
        }