Beispiel #1
0
        public void Pop_EmptyStack_ShouldThrowException()
        {
            //Arrange
            var stack = new ChunkedStack <int>(5);

            //Act
            Assert.Throws <InvalidOperationException>(() => stack.Pop());
        }
Beispiel #2
0
        public void PushPop_ShouldReturnCorrectData()
        {
            //Arrange
            var stack = new ChunkedStack <int>(2);

            //Act
            stack.Push(1);
            stack.Push(2);
            stack.Push(3);
            stack.Push(4);
            stack.Push(5);

            Assert.Equal(5, stack.Count);

            Assert.Equal(5, stack.Pop());
            Assert.Equal(4, stack.Pop());
            Assert.Equal(3, stack.Pop());
            Assert.Equal(2, stack.Pop());
            Assert.Equal(1, stack.Pop());

            Assert.Equal(0, stack.Count);
        }