Esempio n. 1
0
        public void Test_case_1()
        {
            var testResult = OrderedListofLists.Solve(_testList);

            var expected = new StringBuilder();

            expected.AppendLine("1 350");
            expected.AppendLine("2 Banana");
            expected.AppendLine("2.1 second level");
            expected.AppendLine("2.2 nice");
            expected.AppendLine("2.2.1 3");
            expected.AppendLine("3 last");


            Assert.AreEqual(expected.ToString(), testResult);
        }
Esempio n. 2
0
        public void Test_case_2()
        {
            _testList = new List <object>
            {
                "item 1",
                "item 2",
                "item 3",
                new List <object> {
                    "level 2, item 1",
                    "level 2, item 2",
                    new List <object> {
                        "level 3, item 1",
                        new List <object> {
                            "level 4, item 1",
                            "level 4, item 2"
                        },
                        "level 3, item 2",
                    },
                    "level 2, item 3",
                },
                "last item"
            };

            var testResult = OrderedListofLists.Solve(_testList);

            var expected = new StringBuilder();

            expected.AppendLine("1 item 1");
            expected.AppendLine("2 item 2");
            expected.AppendLine("3 item 3");
            expected.AppendLine("3.1 level 2, item 1");
            expected.AppendLine("3.2 level 2, item 2");
            expected.AppendLine("3.2.1 level 3, item 1");
            expected.AppendLine("3.2.1.1 level 4, item 1");
            expected.AppendLine("3.2.1.2 level 4, item 2");
            expected.AppendLine("3.2.2 level 3, item 2");
            expected.AppendLine("3.3 level 2, item 3");
            expected.AppendLine("4 last item");

            Assert.AreEqual(expected.ToString(), testResult);
        }