Exemplo n.º 1
0
            public void NonPiesShouldBeValid(
                ExpiredPieValidator sut)
            {
                IProduct product = new ProductFaker().Generate();

                ValidationResult result = sut.Validate(product);

                result.IsValid.Should().BeTrue();
            }
Exemplo n.º 2
0
            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();
            }
Exemplo n.º 3
0
            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();
            }