Exemplo n.º 1
0
		public void RemoveThePoppedItem()
		{
			// Arrange
			var stackedList = new StackedList<int>();
			stackedList.Push(0);
			stackedList.Push(1);
			stackedList.Push(2);
			stackedList.Push(3);

			// Act
			stackedList.Pop();

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

			// Act
			var poppedItem = stackedList.Pop();

			// Assert
			Assert.That(poppedItem.Equals(3));
		}
Exemplo n.º 3
0
        public void ReturnTheLastItemPushed()
        {
            // Arrange
            var stackedList = new StackedList <int>();

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

            // Act
            var poppedItem = stackedList.Pop();

            // Assert
            Assert.That(poppedItem.Equals(3));
        }
Exemplo n.º 4
0
        public void RemoveThePoppedItem()
        {
            // Arrange
            var stackedList = new StackedList <int>();

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

            // Act
            stackedList.Pop();

            // Assert
            Assert.That(!stackedList.Items.Contains(3));
        }
Exemplo n.º 5
0
        public void ReturnTheCorrectCountGivenPoppedItems(int initialNumberOfItems, int numberOfItemsToPop)
        {
            // Arrange
            var stackedList = new StackedList <int>();

            // Add the items...
            for (var i = 1; i <= initialNumberOfItems; i++)
            {
                stackedList.Push(i);
            }

            // Pop some items...
            for (var i = 1; i <= numberOfItemsToPop; i++)
            {
                stackedList.Pop();
            }

            // Act
            var itemCount = stackedList.Count;

            // Assert
            Assert.That(itemCount.Equals(initialNumberOfItems - numberOfItemsToPop));
        }
Exemplo n.º 6
0
		public void ReturnTheCorrectCountGivenPoppedItems(int initialNumberOfItems, int numberOfItemsToPop)
		{
			// Arrange
			var stackedList = new StackedList<int>();

			// Add the items...
			for (var i = 1; i <= initialNumberOfItems; i++)
			{
				stackedList.Push(i);
			}

			// Pop some items...
			for (var i = 1; i <= numberOfItemsToPop; i++)
			{
				stackedList.Pop();
			}

			// Act
			var itemCount = stackedList.Count;

			// Assert
			Assert.That(itemCount.Equals(initialNumberOfItems - numberOfItemsToPop));
		}