Beispiel #1
0
        public void TestMethodStack8()
        {
            //Arrange
            int[]         arr = new int[] { 1, 2, 3, 4 };
            MyStack <int> s   = new MyStack <int>(arr);

            //Act
            s.Delete(2);
            //Assert
            Assert.IsTrue(s.Count() == 2);
        }
Beispiel #2
0
        public void TestMethodStack9()
        {
            //Arrange
            int[]         arr = new int[] { 1, 2, 3, 4 };
            MyStack <int> s   = new MyStack <int>(arr);

            //Act
            s.Delete();
            //Assert
            Assert.IsTrue(s.StackList.Beg == null);
        }
Beispiel #3
0
    public void Empty()
    {
        MyStack stack = new MyStack();

        stack.CheckInvariant();
        stack.Push("sample");
        stack.CheckInvariant();

        // Popping last element ok
        Assert.That(
            stack.Pop(),
            Is.EqualTo("sample")
            );
        stack.CheckInvariant();

        // Delete from empty stack
        stack.Delete(1);
        stack.CheckInvariant();
    }