//[Property]
        public bool Random_OrderDate_Will_Fail_Simple(DateTime orderDate)
        {
            var discountStart = new TimeSpan(20, 0, 0);
            var discountEnd   = new TimeSpan(21, 0, 0);
            var target        = new YellowStickerDiscountValidator(discountStart, discountEnd);

            return(target.Validate(orderDate));
        }
        public void OrderDate_Is_Not_In_Target_Period_Returns_False()
        {
            var discountStart = new TimeSpan(20, 0, 0);
            var discountEnd   = new TimeSpan(21, 0, 0);
            var target        = new YellowStickerDiscountValidator(discountStart, discountEnd);

            Prop.ForAll(GetRandomOrderDates(discountStart, discountEnd, insidePeriod: false), orderDate => !target.Validate(orderDate))
            .VerboseCheckThrowOnFailure();
        }
        public void Random_OrderDate_Will_Fail()
        {
            var discountStart = new TimeSpan(20, 0, 0);
            var discountEnd   = new TimeSpan(21, 0, 0);
            var target        = new YellowStickerDiscountValidator(discountStart, discountEnd);

            Assert.Throws <Exception>(() =>
                                      Prop.ForAll(Arb.Default.DateTime(), orderDate => target.Validate(orderDate)).QuickCheckThrowOnFailure());
        }
Exemple #4
0
        public void OrderDate_Is_Not_In_Valid_Range_Returns_False()
        {
            // Arrange
            var orderDate     = new DateTime(2018, 1, 5, 19, 30, 0);
            var discountStart = new TimeSpan(20, 0, 0);
            var discountEnd   = new TimeSpan(21, 0, 0);
            var target        = new YellowStickerDiscountValidator(discountStart, discountEnd);

            // Act
            var result = target.Validate(orderDate);

            // Assert
            Assert.False(result);
        }