Example #1
0
        public void OrderOfElementsMaintained()
        {
            // Arrange
            var sut = new QueueFromStacks <int>();

            // Act
            sut.Add(1);
            sut.Add(2);
            sut.Add(3);

            // Assert
            for (var expected = 1; expected <= 3; expected++)
            {
                var actual = sut.Remove();
                Assert.AreEqual(expected, actual);
            }
        }
Example #2
0
        public void RemoveReturnsFirstEntered()
        {
            // Arrange
            var sut      = new QueueFromStacks <int>();
            var expected = 1;

            sut.Add(expected);
            sut.Add(2);
            sut.Add(3);
            var expectedCount = sut.Count - 1;

            // Act
            var actual = sut.Remove();

            // Assert
            Assert.AreEqual(expected, actual);
            Assert.AreEqual(expectedCount, sut.Count);
        }