public async Task ThenTheTotalMonthlyCostIsTheResultOfTheTotalMonthlyCostCalculationAsync()
        {
            var actual = Test.Pages.PreviewOrderSummary.GetTotalMonthlyCost();
            var order  = await OrderHelpers.GetFullOrderAsync(Context.Get <Order>(ContextKeys.CreatedOrder).CallOffId, DbContext);

            actual.Should().Be(FormatDecimal(order.CalculateCostPerYear(CostType.Recurring) / 12));
        }
        public async Task ThenTheSupplierSectionIsSavedInTheDB()
        {
            var order     = Context.Get <Order>(ContextKeys.CreatedOrder);
            var orderInDb = await OrderHelpers.GetFullOrderAsync(order.CallOffId, DbContext);

            orderInDb.SupplierContact.Should().NotBeNull();
        }
Example #3
0
        public async Task ThenTheCall_OffAgreementIDIsDisplayedAsync()
        {
            var order = await OrderHelpers.GetFullOrderAsync(Context.Get <Order>(ContextKeys.CreatedOrder).CallOffId, DbContext);

            var callOffID = order.CallOffId.ToString();

            Test.Pages.OrderForm.EditNamedSectionPageDisplayed(callOffID).Should().BeTrue();
        }
        public async Task ThenTheTotalCostOfContractIsTheResultOfTheTotalCostOfContractCalculationTotalOne_OffCostTotalCostForOneYearCalculationAsync()
        {
            var order = await OrderHelpers.GetFullOrderAsync(Context.Get <Order>(ContextKeys.CreatedOrder).CallOffId, DbContext);

            var actualTotalCostOfContract = Test.Pages.PreviewOrderSummary.GetTotalOwnershipCost();

            actualTotalCostOfContract.Should().Be(FormatDecimal(order.CalculateTotalOwnershipCost()));
        }
Example #5
0
        public async Task ThenTheOrderDescriptionIsDisplayedAsync()
        {
            var order = await OrderHelpers.GetFullOrderAsync(Context.Get <Order>(ContextKeys.CreatedOrder).CallOffId, DbContext);

            var orderDescription = order.Description;

            Test.Pages.OrderForm.DeleteConfirmationOrderDescription().Should().BeEquivalentTo(orderDescription);
        }
Example #6
0
        public async Task ThenTheUserIsAskedToConfirmTheChoiceToDeleteTheCatalogueSolutionAsync()
        {
            var order = await OrderHelpers.GetFullOrderAsync(Context.Get <Order>(ContextKeys.CreatedOrder).CallOffId, DbContext);

            var orderitem = order.OrderItems[0].CatalogueItem.Name;

            Test.Pages.OrderForm.EditNamedSectionPageDisplayed($"Delete {orderitem}").Should().BeTrue();
        }
        public async Task ThenTheCallOffOrderingPartySectionIsSavedInTheDb()
        {
            var contextOrder = Context.Get <Order>(ContextKeys.CreatedOrder);

            var order = await OrderHelpers.GetFullOrderAsync(contextOrder.CallOffId, DbContext);

            order.OrderingParty.Should().NotBeNull();
            order.OrderingPartyContact.Should().NotBeNull();
        }
        public async Task ThenTheItemNameOfEachItemIsTheCatalogueSolutionNameAsync()
        {
            var order = await OrderHelpers.GetFullOrderAsync(Context.Get <Order>(ContextKeys.CreatedOrder).CallOffId, DbContext);

            var expectedOrderItem = order.OrderItems[0];
            var name = Test.Pages.PreviewOrderSummary.GetItemName();

            name.Should().Be(expectedOrderItem.CatalogueItem.Name);
        }
        public async Task ThenThePlannedDeliveryDateOfEachItemIsDisplayedAsync()
        {
            var order = await OrderHelpers.GetFullOrderAsync(Context.Get <Order>(ContextKeys.CreatedOrder).CallOffId, DbContext);

            var expectedOrderItem = order.OrderItems[0];
            var date = Test.Pages.PreviewOrderSummary.GetItemPlannedDate();

            date.Should().Be(expectedOrderItem.DefaultDeliveryDate.Value.ToString("d MMMM yyyy"));
        }
Example #10
0
        public async Task WhenTheUserChoosesToConfirmTheDeleteAsync()
        {
            var wait  = new WebDriverWait(Test.Driver, TimeSpan.FromSeconds(10));
            var order = await OrderHelpers.GetFullOrderAsync(Context.Get <Order>(ContextKeys.CreatedOrder).CallOffId, DbContext);

            Context.Add(ContextKeys.DeletedOrderItem, order.OrderItems[0]);
            Test.Pages.DeleteOrder.ClickDeleteButtonYes();

            wait.Until(s => Test.Pages.OrderForm.ContinueButtonDisplayed());
        }
Example #11
0
        public async Task ThenOnlyTheCatalogueSolutionWithTheUnitIsDeletedFromTheOrderAsync()
        {
            var orderItem = Context.Get <OrderItem>(ContextKeys.DeletedOrderItem);
            var order     = await OrderHelpers.GetFullOrderAsync(Context.Get <Order>(ContextKeys.CreatedOrder).CallOffId, DbContext);

            if (order.OrderItems.Count > 0)
            {
                order.OrderItems.Should().NotContain(orderItem);
            }
        }
        public async Task ThenTheItemYearCostOfEachItemIsTheResultOfTheFlatCalculationPriceQuantityRoundedUpToTwoDecimalPlacesAsync()
        {
            var order = await OrderHelpers.GetFullOrderAsync(Context.Get <Order>(ContextKeys.CreatedOrder).CallOffId, DbContext);

            var expectedOrderItem = order.OrderItems[0];
            var expectedValue     = FormatDecimal(Math.Round(expectedOrderItem.CalculateTotalCostPerYear(), 2));
            var cost = Test.Pages.PreviewOrderSummary.GetItemCost();

            cost.Should().Be(expectedValue.ToString());
        }
        public async Task ThenTheQuantityOfEachItemIsTheConcatenationOfQuantityAndPerPeriodAsync(string period)
        {
            var order = await OrderHelpers.GetFullOrderAsync(Context.Get <Order>(ContextKeys.CreatedOrder).CallOffId, DbContext);

            var expectedOrderItem     = order.OrderItems[0];
            var expectedQuantityValue = $"{expectedOrderItem.OrderItemRecipients[0].Quantity} {period}";

            var actualQuantity = Test.Pages.PreviewOrderSummary.GetItemQuantity();

            actualQuantity.Should().ContainEquivalentOf(expectedQuantityValue);
        }
        public async Task ThenTheQuantityOfEachItemIsQuantityAsync()
        {
            var order = await OrderHelpers.GetFullOrderAsync(Context.Get <Order>(ContextKeys.CreatedOrder).CallOffId, DbContext);

            var expectedOrderItem = order.OrderItems[0];
            var expectedValue     = $"{expectedOrderItem.OrderItemRecipients[0].Quantity}";

            var quantity = Test.Pages.PreviewOrderSummary.GetItemQuantity();

            quantity.Should().ContainEquivalentOf(expectedValue);
        }
        public async Task ThenThePricingValuesWillBePopulatedWithTheValuesThatWasSavedByTheUserAsync()
        {
            var quantityFromPage = Test.Pages.OrderForm.GetQuantity();
            var priceFromPage    = Test.Pages.OrderForm.GetPriceInputValue();
            var order            = await OrderHelpers.GetFullOrderAsync(Context.Get <Order>(ContextKeys.CreatedOrder).CallOffId, DbContext);

            var orderItem = order.OrderItems.Single(i => i.CatalogueItem.CatalogueItemType == CatalogueItemType.AdditionalService);

            quantityFromPage.Should().Be(orderItem.OrderItemRecipients[0].Quantity.ToString());
            priceFromPage.Should().MatchRegex(@"^[0-9]*(\.[0-9]{2,3})?$");
        }
        public async Task ThenTheCommencementDateIsDisplayedAsync()
        {
            var date = Test.Pages.PreviewOrderSummary.GetCommencementDateValue();

            date.Should().NotBeNullOrEmpty();
            var order = await OrderHelpers.GetFullOrderAsync(Context.Get <Order>(ContextKeys.CreatedOrder).CallOffId, DbContext);

            var expectedDate = order.CommencementDate?.ToString("d MMMM yyyy");

            date.Should().EndWithEquivalent(expectedDate);
        }
        public async Task ThenTheQuantityOfEachItemIsTheConcatenationI_E_QuantityPerPeriodAsync()
        {
            var order = await OrderHelpers.GetFullOrderAsync(Context.Get <Order>(ContextKeys.CreatedOrder).CallOffId, DbContext);

            var expectedOrderItem = order.OrderItems[0];
            var expectedPeriod    = expectedOrderItem.EstimationPeriod;
            var expectedValue     = $"{FormatInt(expectedOrderItem.OrderItemRecipients[0].Quantity)} {expectedPeriod.Value.Description()}";

            var quantity = Test.Pages.PreviewOrderSummary.GetItemQuantity();

            quantity.Should().ContainEquivalentOf(expectedValue);
        }
Example #18
0
        public async Task ThenThePreviouslySavedDataIsDisplayedAsync()
        {
            var priceFromPage = decimal.Parse(Test.Pages.OrderForm.GetPriceInputValue());

            var order          = Context.Get <Order>(ContextKeys.CreatedOrder);
            var orderItemsInDb = (await DbContext.Order.FindAsync(order.Id))
                                 .OrderItems.Single(
                s => s.CatalogueItem.CatalogueItemType == CatalogueItemType.AssociatedService);
            var unitOrder = await OrderHelpers.GetFullOrderAsync(Context.Get <Order>(ContextKeys.CreatedOrder).CallOffId, DbContext);

            orderItemsInDb.Price.Value.Should().Be(priceFromPage);
            Test.Pages.OrderForm.GetAssociatedServicesPricingUnit(unitOrder).Should().BeTrue();
        }
        public async Task ThenThePriceUnitOfOrderOfEachItemIsTheConcatenationAsync()
        {
            var order = await OrderHelpers.GetFullOrderAsync(Context.Get <Order>(ContextKeys.CreatedOrder).CallOffId, DbContext);

            var expectedOrderItem = order.OrderItems[0];
            var expectedValue     = $"{FormatDecimal(expectedOrderItem.Price.Value)} {expectedOrderItem.PricingUnit.Description}".Trim();

            if (expectedOrderItem.ProvisioningType != ProvisioningType.OnDemand)
            {
                expectedValue += $" {expectedOrderItem.PriceTimeUnit.Value.Description()}";
            }

            var price = Test.Pages.PreviewOrderSummary.GetItemPrice();

            price.Should().Be(expectedValue);
        }
        public async Task ThenTheCallOffOrderingPartyInformationIsDisplayedAsync()
        {
            var value = Test.Pages.PreviewOrderSummary.GetCallOffOrderingPartyPreviewValue();

            value.Should().NotBeNullOrEmpty();
            var order = await OrderHelpers.GetFullOrderAsync(Context.Get <Order>(ContextKeys.CreatedOrder).CallOffId, DbContext);

            var createdAddress = order.OrderingParty.Address;
            var createdContact = order.OrderingPartyContact;

            value.Should().ContainEquivalentOf(createdAddress.Line1);
            value.Should().ContainEquivalentOf(createdAddress.Town);
            value.Should().ContainEquivalentOf(createdAddress.Postcode);
            var concattedName = string.Format("{0} {1}", createdContact.FirstName, createdContact.LastName);

            value.Should().ContainEquivalentOf(concattedName);
        }
Example #21
0
        public async Task GivenACompleteOrderExists()
        {
            var completeOrder = new CompleteOrder(Test, Context);

            await completeOrder.GivenTheOrderIsCompleteEnoughSoThatTheCompleteOrderButtonIsEnabled("yes");

            var order = await OrderHelpers.GetFullOrderTrackedAsync(Context.Get <Order>(ContextKeys.CreatedOrder).CallOffId, DbContext);

            var result = order.Complete();

            if (!result)
            {
                throw new DbUpdateException($"Order {order.CallOffId} not completed");
            }

            await DbContext.SaveChangesAsync();

            var completedOrder = await OrderHelpers.GetFullOrderAsync(order.CallOffId, DbContext);

            completedOrder.Completed.Should().NotBeNull();

            Test.Driver.Navigate().Refresh();
        }
Example #22
0
        public async Task ThenTheUnitOfOrderColumnContainsTheUnitOfOrderOfTheAssociatedServiceAsync()
        {
            var order = await OrderHelpers.GetFullOrderAsync(Context.Get <Order>(ContextKeys.CreatedOrder).CallOffId, DbContext);

            Test.Pages.OrderForm.GetAssociatedServicesPricingUnit(order).Should().BeTrue();
        }
Example #23
0
        public async Task ThenTheUserIsInformedTheCatalogueSolutionIsDeletedAsync()
        {
            var order = await OrderHelpers.GetFullOrderAsync(Context.Get <Order>(ContextKeys.CreatedOrder).CallOffId, DbContext);

            Test.Pages.OrderForm.DeleteSolutionConfirmationTitle().Should().Match($"* deleted from {order.CallOffId}");
        }