public async Task GivenTheMinimumDataNeededToEnableTheFundingSourceSectionExists() { var commonSteps = new CommonSteps(Test, Context); await commonSteps.GivenAnIncompleteOrderExists(); var order = (Order)Context[ContextKeys.CreatedOrder]; order.OrderingPartyContact = ContactHelper.Generate(); order.CommencementDate = DateTime.Today; var supplier = await DbContext.Supplier.SingleOrDefaultAsync(s => s.Id == "100000") ?? (await SupplierInfo.GetSupplierWithId("100000", Test.BapiConnectionString)).ToDomain(); var orderBuilder = new OrderBuilder(order) .WithExistingSupplier(supplier) .WithSupplierContact(ContactHelper.Generate()); order = orderBuilder.Build(); DbContext.Update(order); await new AssociatedServices(Test, Context).GivenAnAssociatedServiceWithAFlatPriceDeclarativeOrderTypeIsSavedToTheOrder(); await commonSteps.SetOrderCatalogueSectionToComplete(); await commonSteps.SetOrderAdditionalServicesSectionToComplete(); await commonSteps.SetOrderAssociatedServicesSectionToComplete(); }
public async Task GivenTheSelectAssociatedServiceFormIsPresentedAsync() { var order = (Order)Context[ContextKeys.CreatedOrder]; order.OrderingPartyContact = ContactHelper.Generate(); var supplier = await DbContext.Supplier.SingleOrDefaultAsync(s => s.Id == "10000") ?? (await SupplierInfo.GetSupplierWithId("10000", Test.BapiConnectionString)).ToDomain(); var orderBuilder = new OrderBuilder(order) .WithExistingSupplier(supplier) .WithSupplierContact(ContactHelper.Generate()); order = orderBuilder.Build(); DbContext.Update(order); await DbContext.SaveChangesAsync(); Context.Remove(ContextKeys.CreatedOrder); Context.Add(ContextKeys.CreatedOrder, order); WhenTheUserHasChosenToManageTheAssociatedServiceSection(); new CommonSteps(Test, Context).WhenTheUserChoosesToAddAOrderItem(); }
public async Task GivenTheSupplierHasMultipleAdditionalServicesAsync() { var solutionId = await SupplierInfo.GetSolutionWithMultipleAdditionalServices(Test.BapiConnectionString); Context.Add(ContextKeys.ChosenItemId, solutionId); var supplierId = solutionId.Split('-')[0]; var supplier = await DbContext.Supplier.SingleOrDefaultAsync(s => s.Id == supplierId) ?? (await SupplierInfo.GetSupplierWithId(supplierId, Test.BapiConnectionString)).ToDomain(); var order = Context.Get <Order>(ContextKeys.CreatedOrder); order = new OrderBuilder(order) .WithExistingSupplier(supplier) .WithSupplierContact(ContactHelper.Generate()) .WithCommencementDate(DateTime.Today) .WithOrderingPartyContact(ContactHelper.Generate()) .Build(); DbContext.Update(order); await DbContext.SaveChangesAsync(); Context.Remove(ContextKeys.CreatedOrder); Context.Add(ContextKeys.CreatedOrder, order); }
public async Task GivenAnIncompleteOrderWithCatalogueItemsExists() { await GivenAnIncompleteOrderExists(); var order = Context.Get <Order>(ContextKeys.CreatedOrder); order.OrderingPartyContact = ContactHelper.Generate(); order.CommencementDate = DateTime.Today; var supplier = await DbContext.Supplier.SingleOrDefaultAsync(s => s.Id == "100000") ?? (await SupplierInfo.GetSupplierWithId("100000", Test.BapiConnectionString)).ToDomain(); var orderBuilder = new OrderBuilder(order) .WithExistingSupplier(supplier) .WithSupplierContact(ContactHelper.Generate()); order = orderBuilder.Build(); DbContext.Update(order); await DbContext.SaveChangesAsync(); await GivenACatalogueSolutionWithAFlatPriceVariableDeclarativeOrderTypeIsSavedToTheOrder(100); Context.Remove(ContextKeys.CreatedOrder); Context.Add(ContextKeys.CreatedOrder, order); }
public async Task GivenTheSupplierAddedToTheOrderHasASolutionWithAVariableFlatPrice() { var supplierInfo = (await SupplierInfo.SuppliersWithCatalogueSolution(Test.BapiConnectionString, ProvisioningType.OnDemand)).First().ToDomain(); var supplier = await DbContext.Supplier.FindAsync(supplierInfo.Id) ?? supplierInfo; var order = Context.Get <Order>(ContextKeys.CreatedOrder); order.Supplier = supplier; order.SupplierContact = ContactHelper.Generate(); DbContext.Update(order); await DbContext.SaveChangesAsync(); }
public async Task GivenTheCallOffOrderingPartySectionIsComplete() { var order = Context.Get <Order>(ContextKeys.CreatedOrder); var orderBuilder = new OrderBuilder(order) .WithOrderingPartyContact(ContactHelper.Generate()); order = orderBuilder.Build(); DbContext.Update(order); await DbContext.SaveChangesAsync(); Context.Remove(ContextKeys.CreatedOrder); Context.Add(ContextKeys.CreatedOrder, order); }
public async Task GivenASupplierHasBeenSelected() { var order = Context.Get <Order>(ContextKeys.CreatedOrder); var supplier = await DbContext.Supplier.SingleOrDefaultAsync(s => s.Id == "100000") ?? (await SupplierInfo.GetSupplierWithId("100000", Test.BapiConnectionString)).ToDomain(); var orderBuilder = new OrderBuilder(order) .WithExistingSupplier(supplier) .WithSupplierContact(ContactHelper.Generate()); order = orderBuilder.Build(); DbContext.Update(order); await DbContext.SaveChangesAsync(); Context.Remove(ContextKeys.CreatedOrder); Context.Add(ContextKeys.CreatedOrder, order); }
public async Task GivenTheSupplierAndCallOffOrderingPartySectionsAreComplete() { var order = (Order)Context[ContextKeys.CreatedOrder]; order.OrderingPartyContact = ContactHelper.Generate(); var supplier = await DbContext.Supplier.SingleOrDefaultAsync(s => s.Id == "100000") ?? (await SupplierInfo.GetSupplierWithId("100000", Test.BapiConnectionString)).ToDomain(); var orderBuilder = new OrderBuilder(order) .WithExistingSupplier(supplier) .WithSupplierContact(ContactHelper.Generate()); order = orderBuilder.Build(); DbContext.Update(order); await DbContext.SaveChangesAsync(); Context.Remove(ContextKeys.CreatedOrder); Context.Add(ContextKeys.CreatedOrder, order); }
public void GivenTheUserHasEnteredAValidCallOffOrderingPartyContactForTheOrder() { var contact = ContactHelper.Generate(); Test.Pages.OrderForm.EnterContact(contact); }
public async Task GivenTheOrderIsCompleteEnoughSoThatTheCompleteOrderButtonIsEnabled(string fsValue) { bool fs = fsValue.ToLower() == "yes"; await new CommonSteps(Test, Context).GivenAnIncompleteOrderExists(); var order = Context.Get <Order>(ContextKeys.CreatedOrder); var supplier = await DbContext.Supplier.SingleOrDefaultAsync(s => s.Id == "100000") ?? (await SupplierInfo.GetSupplierWithId("100000", Test.BapiConnectionString)).ToDomain(); var orderBuilder = new OrderBuilder(order) .WithExistingSupplier(supplier) .WithSupplierContact(ContactHelper.Generate()) .WithCommencementDate(DateTime.Today) .WithOrderingPartyContact(ContactHelper.Generate()) .WithFundingSource(fs); var associatedServices = await SupplierInfo.GetPublishedCatalogueItemsNoTieredAsync(Test.BapiConnectionString, supplier.Id, CatalogueItemType.AssociatedService); var selectedItem = associatedServices.First(); var catalogueItem = await DbContext.FindAsync <CatalogueItem>(CatalogueItemId.ParseExact(selectedItem.CatalogueItemId)) ?? selectedItem.ToDomain(); var pricingUnitName = "per banana"; var pricingUnit = await DbContext.FindAsync <PricingUnit>(pricingUnitName) ?? new PricingUnit { Name = pricingUnitName, }; pricingUnit.Description = pricingUnitName; var recipients = new List <OrderItemRecipient>(); var recipient = await DbContext.ServiceRecipient.SingleOrDefaultAsync(s => s.OdsCode == order.OrderingParty.OdsCode) ?? new ServiceRecipient(order.OrderingParty.OdsCode, order.OrderingParty.Name); var orderItemRecipient = new OrderItemRecipient() { Recipient = recipient, DeliveryDate = DateTime.UtcNow, Quantity = 1, }; recipients.Add(orderItemRecipient); var orderItem = new OrderItemBuilder(order.Id) .WithCatalogueItem(catalogueItem) .WithCataloguePriceType(CataloguePriceType.Flat) .WithCurrencyCode() .WithDefaultDeliveryDate(DateTime.Today) .WithPrice(0.01M) .WithPricingTimeUnit(TimeUnit.PerMonth) .WithProvisioningType(ProvisioningType.Declarative) .WithPricingUnit(pricingUnit) .WithRecipients(recipients) .Build(); order.AddOrUpdateOrderItem(orderItem); await OrderProgressHelper.SetProgress( context : DbContext, order : order, catalogueSolutionsViewed : true, additionalServicesViewed : true, associatedServicesViewed : true); DbContext.Update(order); await DbContext.SaveChangesAsync(); Context.Remove(ContextKeys.CreatedOrder); Context.Add(ContextKeys.CreatedOrder, order); Test.Driver.Navigate().Refresh(); }