public void LastReturnsLastValueAfterPoppingPreviousValues(int itemsToRemove)
        {
            var items = new List <object>();

            var sut = new BuildHistory();

            for (var index = 0; index < 5; index++)
            {
                var item = Model.Create <Person>() !;

                items.Add(item);

                sut.Push(item);
            }

            sut.Last.Should().BeSameAs(items.Last());

            for (var index = 0; index <= itemsToRemove; index++)
            {
                sut.Last.Should().BeSameAs(items[4 - index]);

                sut.Pop();

                sut.Last.Should().BeSameAs(items[3 - index]);
            }
        }
        public void PopThrowsExceptionWhenHistoryIsEmpty()
        {
            var sut = new BuildHistory();

            Action action = () => sut.Pop();

            action.Should().Throw <InvalidOperationException>();
        }
        public void LastReturnsNullAfterLastItemRemoved()
        {
            var sut = new BuildHistory();

            var item = Model.Create <Person>() !;

            sut.Push(item);

            sut.Last.Should().BeSameAs(item);

            sut.Pop();

            sut.Last.Should().BeNull();
        }