示例#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());
        }