Exemplo n.º 1
0
        public void ReceiptOneDuraAce()
        {
            var order = new OrderViewModel(Substitute.For <IDiscountCalculator <OrderViewModel> >(), Substitute.For <IDiscountCalculator <LineViewModel> >(), new Order("Anywhere Bike Shop", "USD", 0.0725m));

            order.AddLine(new Line(DuraAce, 1));
            var generator = new StringReceiptBuilder();

            Assert.AreEqual(ResultStatementOneDuraAce, generator.GenerateReceipt(order));
        }
Exemplo n.º 2
0
        public string ReceiptOneDefy(int amount)
        {
            var lineDiscount = new DiscountStrategyCalculator <LineViewModel>();

            lineDiscount.Configure()
            .When(line => line.Quantity >= 20 && line.Price >= 1000)
            .ApplyDiscount(line => line.Quantity * line.Price * 0.1m);
            var orderVm = new OrderViewModel(Substitute.For <IDiscountCalculator <OrderViewModel> >(), lineDiscount, new Order("Anywhere Bike Shop", "USD", 0.0725m));

            orderVm.AddLine(new Line(Defy, amount));
            var generator = new StringReceiptBuilder();

            return(generator.GenerateReceipt(orderVm));
        }