Пример #1
0
        private static List <Domain.App.Price> GenerateListOfPriceFromFaker(int count)
        {
            var fakerPrices = new PriceFaker(DateTime.UtcNow.Subtract(TimeSpan.FromHours(24)),
                                             DateTime.UtcNow.Add(TimeSpan.FromDays(24))).Generate(count);

            return(fakerPrices.Select(fp => new Price()
            {
                Amount = fp.Amount,
                From = fp.From,
                To = fp.To
            }).ToList());
        }
            public void PieAndPortionOfChipsShouldBeDiscounted(
                PieAndChipsMealDealDiscount sut)
            {
                PriceFaker priceFaker = new PriceFaker();

                Pie            pie            = new Pie(priceFaker.Generate(), LocalDate.MaxIsoValue);
                PortionOfChips portionOfChips = new PortionOfChips(priceFaker.Generate());

                IEnumerable <Discount> results = sut.CalculateDiscounts(new IProduct[] { pie, portionOfChips });

                Price expectedDicountPrice = new Price((pie.Price + portionOfChips.Price) * (sut.DiscountPercent / 100.0m));

                results.Should().Contain(new Discount(expectedDicountPrice, pie, portionOfChips));
            }