public void TicketBuilder_CreatesTicketWithDepartment_DepartmentAssigned() { var context = TicketBuilderTestContext.GetDefaultContext(); var ticket = TicketBuilder.Create(context.TicketType, context.Department).Build(); Assert.AreEqual(1, ticket.DepartmentId); }
public void TicketBuilder_CreatesDefaultTicket_IsDefaultExchangeRate() { var context = TicketBuilderTestContext.GetDefaultContext(); var ticket = TicketBuilder.Create(context.TicketType, context.Department).Build(); Assert.AreEqual(1, ticket.ExchangeRate); }
public void TicketBuilder_CreatesDefaultTicket_CreatesAccountTransactionDocument() { var context = TicketBuilderTestContext.GetDefaultContext(); var ticket = TicketBuilder.Create(context.TicketType, context.Department).Build(); Assert.IsNotNull(ticket.TransactionDocument); }
public void TicketBuilder_CreatesTaxExcludedTicket_IsTaxExcluded() { var context = TicketBuilderTestContext.GetDefaultContext().WithTicketTypeTaxIsExcluded(); var ticket = TicketBuilder.Create(context.TicketType, context.Department).Build(); Assert.False(ticket.TaxIncluded); }
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); }
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()); }
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)); }
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); }
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); }
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()); }