public void Next_WhenInfoCollectionIsEmpty_ReturnsNull()
        {
            IInfoCollection <ICreditInfo, Sut> sut = CreateSut();

            IInfo <ICreditInfo> result = sut.Next(_fixture.BuildCreditInfoMock().Object);

            Assert.That(result, Is.Null);
        }
        public void Next_WhenInfoCollectionContainsNextInfoElement_ReturnsNextInfoElement()
        {
            IInfoCollection <ICreditInfo, Sut> sut = CreateSut();

            DateTime infoOffset = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1);

            sut.Add(_fixture.BuildCreditInfoMock(infoOffset).Object);
            sut.Add(_fixture.BuildCreditInfoMock(infoOffset.AddMonths(-1)).Object);
            sut.Add(_fixture.BuildCreditInfoMock(infoOffset.AddMonths(-2)).Object);

            IInfo <ICreditInfo> result = sut.Next(sut.First());

            Assert.That(result.Year == infoOffset.AddMonths(-1).Year&& result.Month == infoOffset.AddMonths(-1).Month, Is.True);
        }
        public void Next_WhenInfoCollectionDoesNotContainNextInfoElement_ReturnsNull()
        {
            IInfoCollection <ICreditInfo, Sut> sut = CreateSut();

            DateTime infoOffset = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1);

            sut.Add(_fixture.BuildCreditInfoMock(infoOffset).Object);
            sut.Add(_fixture.BuildCreditInfoMock(infoOffset.AddMonths(-1)).Object);
            sut.Add(_fixture.BuildCreditInfoMock(infoOffset.AddMonths(-2)).Object);

            IInfo <ICreditInfo> result = sut.Next(sut.Last());

            Assert.That(result, Is.Null);
        }
        public void Next_WhenInfoIsNull_ThrowsArgumentNullException()
        {
            IInfoCollection <ICreditInfo, Sut> sut = CreateSut();

            ArgumentNullException result = Assert.Throws <ArgumentNullException>(() => sut.Next(null));

            // ReSharper disable PossibleNullReferenceException
            Assert.That(result.ParamName, Is.EqualTo("info"));
            // ReSharper restore PossibleNullReferenceException
        }