public void Add_WithoutNullState_DoesNotThrowAnException()
        {
            // Arrange
            var state = new TestState();
            var subject = new DepthFirstSearchFringe<TestState>();

            // Act
            Action act = () => subject.Add(state);

            // Assert
            act();
        }
        public void GetNext_WhenTheFringeIsNotEmpty_ShouldReturnItemsInALastInFirstOutOrder()
        {
            // Arrange
            var in_1 = new TestState();
            var in_2 = new TestState();
            var in_3 = new TestState();

            var subject = new DepthFirstSearchFringe<TestState>();
            subject.Add(in_1);
            subject.Add(in_2);
            subject.Add(in_3);

            // Act
            var out_1 = subject.GetNext();
            var out_2 = subject.GetNext();
            var out_3 = subject.GetNext();

            // Assert
            Assert.Equal(out_1, in_3);
            Assert.Equal(out_2, in_2);
            Assert.Equal(out_3, in_1);
        }
        public void Add_WithNullState_ThrowsAnArgumentNullException()
        {
            // Arrange
            var subject = new DepthFirstSearchFringe<TestState>();

            // Act
            Action act = () => subject.Add(null);

            // Assert
            var ex = Assert.Throws<ArgumentNullException>(act);
            Assert.Equal("state", ex.ParamName);
            Assert.NotNull(ex.Message);
        }
        public void GetNext_WhenTheFringeIsNotEmpty_ShouldReturnAnAddedItem()
        {
            // Arrange
            var expected = new TestState();

            var subject = new DepthFirstSearchFringe<TestState>();
            subject.Add(expected);

            // Act
            var result = subject.GetNext();

            // Assert
            Assert.Equal(expected, result);
        }
        public void IsEmpty_AfterMoreItemsHaveBeenAddedThanRemoved_ShouldReturnFalse()
        {
            // Arrange
            var subject = new DepthFirstSearchFringe<TestState>();

            subject.Add(new TestState());
            subject.Add(new TestState());
            subject.Add(new TestState());

            subject.GetNext();
            subject.GetNext();

            // Act
            var result = subject.IsEmpty();

            // Assert
            Assert.False(result);
        }
        public void IsEmpty_WhenTheSameNumberOfItemsHaveBeenRemovedAsWereAdded_ShouldReturnTrue()
        {
            // Arrange
            var subject = new DepthFirstSearchFringe<TestState>();

            subject.Add(new TestState());
            subject.Add(new TestState());
            subject.Add(new TestState());

            subject.GetNext();
            subject.GetNext();
            subject.GetNext();

            // Act
            var result = subject.IsEmpty();

            // Assert
            Assert.True(result);
        }