public void Prev_WhenInfoCollectionIsEmpty_ReturnsNull() { IInfoCollection <ICreditInfo, Sut> sut = CreateSut(); IInfo <ICreditInfo> result = sut.Prev(_fixture.BuildCreditInfoMock().Object); Assert.That(result, Is.Null); }
public void Prev_WhenInfoCollectionContainsPreviousInfoElement_ReturnsPreviousInfoElement() { 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.Prev(sut.Last()); Assert.That(result.Year == infoOffset.AddMonths(-1).Year&& result.Month == infoOffset.AddMonths(-1).Month, Is.True); }
public void Prev_WhenInfoCollectionDoesNotContainPreviousInfoElement_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.Prev(sut.First()); Assert.That(result, Is.Null); }
public void Prev_WhenInfoIsNull_ThrowsArgumentNullException() { IInfoCollection <ICreditInfo, Sut> sut = CreateSut(); ArgumentNullException result = Assert.Throws <ArgumentNullException>(() => sut.Prev(null)); // ReSharper disable PossibleNullReferenceException Assert.That(result.ParamName, Is.EqualTo("info")); // ReSharper restore PossibleNullReferenceException }