Example #1
0
		public void NotChangeThePositionOfThePeekedItem()
		{
			// Arrange
			var stackedList = new StackedList<int>();
			stackedList.Push(0);
			stackedList.Push(1);
			stackedList.Push(2);
			stackedList.Push(3);

			// Act
			stackedList.Peek();
			stackedList.Peek();
			stackedList.Peek();

			// Assert
			Assert.That(stackedList.Peek() == 3);
		}
Example #2
0
        public void NotChangeThePositionOfThePeekedItem()
        {
            // Arrange
            var stackedList = new StackedList <int>();

            stackedList.Push(0);
            stackedList.Push(1);
            stackedList.Push(2);
            stackedList.Push(3);

            // Act
            stackedList.Peek();
            stackedList.Peek();
            stackedList.Peek();

            // Assert
            Assert.That(stackedList.Peek() == 3);
        }
Example #3
0
		public void NotRemoveThePeekedItem()
		{
			// Arrange
			var stackedList = new StackedList<int>();
			stackedList.Push(0);
			stackedList.Push(1);
			stackedList.Push(2);
			stackedList.Push(3);

			// Act
			stackedList.Peek();

			// Assert
			Assert.That(stackedList.Items.Contains(3));
		}
Example #4
0
		public void ReturnTheLastItemPushed()
		{
			// Arrange
			var stackedList = new StackedList<int>();
			stackedList.Push(0);
			stackedList.Push(1);
			stackedList.Push(2);
			stackedList.Push(3);

			// Act
			var peekedItem = stackedList.Peek();

			// Assert
			Assert.That(peekedItem.Equals(3));
		}
Example #5
0
        public void NotRemoveThePeekedItem()
        {
            // Arrange
            var stackedList = new StackedList <int>();

            stackedList.Push(0);
            stackedList.Push(1);
            stackedList.Push(2);
            stackedList.Push(3);

            // Act
            stackedList.Peek();

            // Assert
            Assert.That(stackedList.Items.Contains(3));
        }
Example #6
0
        public void ReturnTheLastItemPushed()
        {
            // Arrange
            var stackedList = new StackedList <int>();

            stackedList.Push(0);
            stackedList.Push(1);
            stackedList.Push(2);
            stackedList.Push(3);

            // Act
            var peekedItem = stackedList.Peek();

            // Assert
            Assert.That(peekedItem.Equals(3));
        }
Example #7
0
		public void NotChangeThePeekedValueGivenRemovalOfAnItemBelow()
		{
			// Arrange
			var stackedList = new StackedList<int>();
			stackedList.Push(0);
			stackedList.Push(1);
			stackedList.Push(2);
			stackedList.Push(3);
			stackedList.Push(4);

			// Act
			stackedList.Remove(2);

			// Assert
			Assert.That(stackedList.Peek() == 4);
		}
Example #8
0
        public void ReturnTheItemBeforeTheLastItemPushedGivenLastItemRemoved()
        {
            // Arrange
            var stackedList = new StackedList <int>();

            stackedList.Push(0);
            stackedList.Push(1);
            stackedList.Push(2);
            stackedList.Push(3);
            stackedList.Push(4);

            // Act
            stackedList.Remove(4);

            // Assert
            Assert.That(stackedList.Peek() == 3);
        }
Example #9
0
        public void NotChangeThePeekedValueGivenRemovalOfAnItemBelow()
        {
            // Arrange
            var stackedList = new StackedList <int>();

            stackedList.Push(0);
            stackedList.Push(1);
            stackedList.Push(2);
            stackedList.Push(3);
            stackedList.Push(4);

            // Act
            stackedList.Remove(2);

            // Assert
            Assert.That(stackedList.Peek() == 4);
        }
Example #10
0
        public void ReturnTheCorrectItemGivenMultipleItemsRemoved()
        {
            // Arrange
            var stackedList = new StackedList <int>();

            stackedList.Push(0);
            stackedList.Push(1);
            stackedList.Push(2);
            stackedList.Push(3);
            stackedList.Push(4);

            // Act
            stackedList.Remove(3);
            stackedList.Remove(1);

            // Assert
            Assert.That(stackedList.Peek() == 4);
        }
Example #11
0
		public void ReturnTheItemBeforeTheLastItemPushedGivenLastItemRemoved()
		{
			// Arrange
			var stackedList = new StackedList<int>();
			stackedList.Push(0);
			stackedList.Push(1);
			stackedList.Push(2);
			stackedList.Push(3);
			stackedList.Push(4);

			// Act
			stackedList.Remove(4);

			// Assert
			Assert.That(stackedList.Peek() == 3);
		}
Example #12
0
		public void ReturnTheCorrectItemGivenMultipleItemsRemoved()
		{
			// Arrange
			var stackedList = new StackedList<int>();
			stackedList.Push(0);
			stackedList.Push(1);
			stackedList.Push(2);
			stackedList.Push(3);
			stackedList.Push(4);

			// Act
			stackedList.Remove(3);
			stackedList.Remove(1);

			// Assert
			Assert.That(stackedList.Peek() == 4);
		}