示例#1
0
        public void TestToStringOverrideEmptyList()
        {
            MyLL <int> ll     = new MyLL <int>();
            var        expect = "";
            var        actual = ll.ToString();

            Assert.AreEqual(expect, actual);
        }
示例#2
0
        public void TestToStringOverride()
        {
            int[]      intArray = { 1, 2, 3 };
            MyLL <int> ll       = new MyLL <int>(intArray);
            var        expect   = "1, 2, 3";
            var        actual   = ll.ToString();

            Assert.AreEqual(expect, actual);
        }
示例#3
0
        public void TestAddAtEndToEmptyList()
        {
            MyLL <int> ll     = new MyLL <int>();
            var        expect = "1";

            ll.AddAtEnd(1);
            var actual = ll.ToString();

            Assert.AreEqual(expect, actual);
        }
示例#4
0
        public void TestAddAtFrontToNonEmptyList()
        {
            MyLL <int> ll     = new MyLL <int>(1);
            var        expect = "2, 1";

            ll.AddAtFront(2);
            var actual = ll.ToString();

            Assert.AreEqual(expect, actual);
        }
示例#5
0
        public void TestRemoveBeforeDataPresentItemBeforePresentFirstItem()
        {
            int[]      intArray = { 1, 2, 3 };
            MyLL <int> ll       = new MyLL <int>(intArray);

            ll.RemoveBefore(2);
            var expect = "2, 3";
            var actual = ll.ToString();

            Assert.AreEqual(expect, actual);
        }
示例#6
0
        public void TestRemoveAfterDataPresentItemAfterPresentLastItem()
        {
            int[]      intArray = { 1, 2, 3 };
            MyLL <int> ll       = new MyLL <int>(intArray);

            ll.RemoveAfter(2);
            var expect = "1, 2";
            var actual = ll.ToString();

            Assert.AreEqual(expect, actual);
        }
示例#7
0
        public void TestDeleteIndexPresent()
        {
            int[]      intArray = { 1, 2, 3 };
            MyLL <int> ll       = new MyLL <int>(intArray);

            ll.DeleteIndex(1);
            var expect = "1, 3";
            var actual = ll.ToString();

            Assert.AreEqual(expect, actual);
        }
示例#8
0
        public void TestAppendNonEmptyToEmpty()
        {
            MyLL <int> lla = new MyLL <int>(1);
            MyLL <int> llb = new MyLL <int>();

            lla.Append(llb);
            var expect = "1";
            var actual = lla.ToString();

            Assert.AreEqual(expect, actual);
        }
示例#9
0
        public void TestAddBeforeDataPresent()
        {
            int[]      intArray = { 1, 2, 3 };
            MyLL <int> ll       = new MyLL <int>(intArray);

            ll.AddBefore(2, 4);
            var expect = "1, 4, 2, 3";
            var actual = ll.ToString();

            Assert.AreEqual(expect, actual);
        }
示例#10
0
        public void TestAppendNonEmptyToNonEmpty()
        {
            int[]      intsA = { 1, 2 };
            int[]      intsB = { 3, 4 };
            MyLL <int> lla   = new MyLL <int>(intsA);
            MyLL <int> llb   = new MyLL <int>(intsB);

            lla.Append(llb);
            var expect = "1, 2, 3, 4";
            var actual = lla.ToString();

            Assert.AreEqual(expect, actual);
        }