예제 #1
0
        public void MyLinkedList_1_Constructor0_2_ThrowsExceptionOnGetFirst()
        {
            // Arrange
            IMyLinkedList <string> lst = DSBuilder.CreateMyLinkedList();

            // Act & Assert
            Assert.Throws(typeof(MyLinkedListEmptyException), () => lst.GetFirst());
        }
예제 #2
0
        public void MyLinkedList_2_AddFirst_3_GetFirstOkAfter1Insert()
        {
            // Arrange
            IMyLinkedList <string> lst = DSBuilder.CreateMyLinkedList();
            string expected            = "1";

            // Act
            lst.AddFirst("1");
            string actual = lst.GetFirst();

            // Assert
            Assert.AreEqual(expected, actual);
        }
예제 #3
0
        public void MyLinkedList_5_Insert_06_GetFirstOkAfterInsertAtBeginningOnEmptyList()
        {
            // Arrange
            IMyLinkedList <string> lst = DSBuilder.CreateMyLinkedList();
            string expected            = "1";

            // Act
            lst.Insert(0, "1");
            string actual = lst.GetFirst();

            // Assert
            Assert.AreEqual(expected, actual);
        }
예제 #4
0
        public void MyLinkedList_3_RemoveFirst_4_ThrowsExceptionOnGetFirstAdter1Insert()
        {
            // Arrange
            IMyLinkedList <string> lst = DSBuilder.CreateMyLinkedList();

            lst.AddFirst("1");

            // Act
            lst.RemoveFirst();

            // Act & Assert
            Assert.Throws(typeof(MyLinkedListEmptyException), () => lst.GetFirst());
        }
예제 #5
0
        public void MyLinkedList_5_Insert_13_GetFirstOkAfterInsertInMiddleOnList3()
        {
            // Arrange
            IMyLinkedList <string> lst = DSBuilder.CreateMyLinkedList();

            lst.AddFirst("1");
            lst.AddFirst("2");
            lst.AddFirst("3");
            string expected = "3";

            // Act
            lst.Insert(1, "4");
            string actual = lst.GetFirst();

            // Assert
            Assert.AreEqual(expected, actual);
        }
예제 #6
0
        public void MyLinkedList_3_RemoveFirst_5_GetFirstOkAfter3Inserts()
        {
            // Arrange
            IMyLinkedList <string> lst = DSBuilder.CreateMyLinkedList();

            lst.AddFirst("1");
            lst.AddFirst("2");
            lst.AddFirst("3");
            string expected = "2";

            // Act
            lst.RemoveFirst();
            string actual = lst.GetFirst();

            // Assert
            Assert.AreEqual(expected, actual);
        }
예제 #7
0
        public void MyLinkedList_5_Insert_11_GetLastOkAfterInsertAtEndOnList3()
        {
            // Arrange
            IMyLinkedList <string> lst = DSBuilder.CreateMyLinkedList();

            lst.AddFirst("1");
            lst.AddFirst("2");
            lst.AddFirst("3");
            string expected = "4";

            // Act
            lst.Insert(3, "4");
            lst.RemoveFirst();
            lst.RemoveFirst();
            lst.RemoveFirst();
            string actual = lst.GetFirst();

            // Assert
            Assert.AreEqual(expected, actual);
        }