public void NonPiesShouldBeValid( ExpiredPieValidator sut) { IProduct product = new ProductFaker().Generate(); ValidationResult result = sut.Validate(product); result.IsValid.Should().BeTrue(); }
public void UnexpiredPieShouldBeValid( int advanceDays, [Frozen(Matching.ImplementedInterfaces)] FakeClock fakeClock, ExpiredPieValidator sut) { Pie pie = new Pie(default(Price), fakeClock.GetCurrentInstant().InUtc().LocalDateTime.Date); // Roll the clock back so the pie will not have expired. fakeClock.AdvanceDays(advanceDays); ValidationResult result = sut.Validate(pie); result.IsValid.Should().BeTrue(); }
public void ExpiredPieShouldNotBeValid( int advanceDays, [Frozen(Matching.ImplementedInterfaces)] FakeClock fakeClock, ExpiredPieValidator sut) { Pie pie = new Pie(default(Price), fakeClock.GetCurrentInstant().InUtc().LocalDateTime.Date); // Advance the clock forward so the pie is now expired. fakeClock.AdvanceDays(advanceDays); ValidationResult result = sut.Validate(pie); result.IsValid.Should().BeFalse(); }