Exemplo n.º 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);
		}
Exemplo n.º 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);
        }
Exemplo n.º 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));
		}
Exemplo n.º 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));
		}
Exemplo n.º 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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 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);
		}
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
		}
Exemplo n.º 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);
		}