Esempio n. 1
0
        public void TicketBuilder_CreatesTicketWithDepartment_DepartmentAssigned()
        {
            var context = TicketBuilderTestContext.GetDefaultContext();
            var ticket  = TicketBuilder.Create(context.TicketType, context.Department).Build();

            Assert.AreEqual(1, ticket.DepartmentId);
        }
Esempio n. 2
0
        public void TicketBuilder_CreatesDefaultTicket_IsDefaultExchangeRate()
        {
            var context = TicketBuilderTestContext.GetDefaultContext();
            var ticket  = TicketBuilder.Create(context.TicketType, context.Department).Build();

            Assert.AreEqual(1, ticket.ExchangeRate);
        }
Esempio n. 3
0
        public void TicketBuilder_CreatesDefaultTicket_CreatesAccountTransactionDocument()
        {
            var context = TicketBuilderTestContext.GetDefaultContext();
            var ticket  = TicketBuilder.Create(context.TicketType, context.Department).Build();

            Assert.IsNotNull(ticket.TransactionDocument);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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());
        }
Esempio n. 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));
        }
Esempio n. 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);
        }
Esempio n. 9
0
        public static TicketBuilderTestContext GetDefaultContext()
        {
            var result = new TicketBuilderTestContext();

            result.TicketType = new TicketType {
                Id = 1, SaleTransactionType = AccountTransactionType.Default
            };
            result.Department = new Department {
                Id = 1
            };
            return(result);
        }
Esempio n. 10
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());
        }