Пример #1
0
        public void TicketBuilder_CreatesDefaultTicket_IsDefaultExchangeRate()
        {
            var context = TicketBuilderTestContext.GetDefaultContext();
            var ticket  = TicketBuilder.Create(context.TicketType, context.Department).Build();

            Assert.AreEqual(1, ticket.ExchangeRate);
        }
Пример #2
0
        public void TicketBuilder_CreatesTicketWithDepartment_DepartmentAssigned()
        {
            var context = TicketBuilderTestContext.GetDefaultContext();
            var ticket  = TicketBuilder.Create(context.TicketType, context.Department).Build();

            Assert.AreEqual(1, ticket.DepartmentId);
        }
Пример #3
0
        public void TicketBuilder_CreatesDefaultTicket_CreatesAccountTransactionDocument()
        {
            var context = TicketBuilderTestContext.GetDefaultContext();
            var ticket  = TicketBuilder.Create(context.TicketType, context.Department).Build();

            Assert.IsNotNull(ticket.TransactionDocument);
        }
Пример #4
0
        public void TicketBuilder_CreatesTaxExcludedTicket_IsTaxExcluded()
        {
            var context = TicketBuilderTestContext.GetDefaultContext().WithTicketTypeTaxIsExcluded();
            var ticket  = TicketBuilder.Create(context.TicketType, context.Department).Build();

            Assert.False(ticket.TaxIncluded);
        }
Пример #5
0
        public void TicketBuilder_CreatesDefaultTicket_TicketTypeIdAssigned()
        {
            var context = TicketBuilderTestContext.GetDefaultContext();
            var ticket  = TicketBuilder.Create(context.TicketType, context.Department).Build();

            Assert.AreEqual(context.TicketType.Id, ticket.TicketTypeId);
        }
Пример #6
0
        public void TicketBuilder_CreatesOrder_OrderAdded()
        {
            var context = TicketBuilderTestContext.GetDefaultContext();
            var ticket  = TicketBuilder.Create(context.TicketType, context.Department)
                          .AddOrder().ForMenuItem(MenuItemBuilder.Create("Hamburger").AddPortion("Adet", 10).Build()).Do()
                          .Build();

            Assert.AreEqual(10, ticket.GetSum());
        }
Пример #7
0
        public void TicketBuilder_CreatesTicketWithCalculations_DiscountAdded()
        {
            var context = TicketBuilderTestContext.GetDefaultContext().With10PercentDiscount();
            var ticket  = TicketBuilder.Create(context.TicketType, context.Department)
                          .WithCalculations(context.Calculations)
                          .Build();

            Assert.AreEqual(10, ticket.Calculations.Sum(x => x.Amount));
        }
Пример #8
0
        public void TicketBuilder_CreatesTicketWithExchangeRate_ExchangeRateAssigned()
        {
            var context = TicketBuilderTestContext.GetDefaultContext();
            var ticket  = TicketBuilder.Create(context.TicketType, context.Department)
                          .WithExchangeRate(1.1m)
                          .Build();

            Assert.AreEqual(1.1m, ticket.ExchangeRate);
        }
Пример #9
0
        public void TicketBuilder_AddsOrderWithMultipleMenuItems_OrdersAdded2()
        {
            var context = TicketBuilderTestContext.GetDefaultContext();

            var hamburger = MenuItemBuilder.Create("Hamburger").AddPortion("Adet", 10).Build();
            var tost      = MenuItemBuilder.Create("Tost").AddPortion("Adet", 4).Build();

            var ticket = TicketBuilder.Create(context.TicketType, context.Department)
                         .AddOrderFor(hamburger).Do()
                         .AddOrderFor(tost).WithQuantity(2).Do()
                         .Build();

            Assert.AreEqual(10 + (4 * 2), ticket.GetSum());
        }