public static void Create_ValidOrder_SetsOrderParty(Order order) { var actual = OrderModel.Create(order); actual.OrderParty.Should() .BeEquivalentTo(new OrderingPartyModel(order.OrderingParty, order.OrderingPartyContact)); }
public static void Create_OrderItems_SetsTimeUnitDescription(Order order) { var actual = OrderModel.Create(order).OrderItems; for (int i = 0; i < actual.Count; i++) { actual[i].TimeUnitDescription.Should().Be(order.OrderItems[i].PriceTimeUnit?.Description()); } }
public static void Create_OrderItems_SetsProvisioningType(Order order) { var actual = OrderModel.Create(order).OrderItems; for (int i = 0; i < actual.Count; i++) { actual[i].ProvisioningType.Should().Be(order.OrderItems[i].ProvisioningType.ToString()); } }
public static void Create_OrderItems_SetsPrice(Order order) { var actual = OrderModel.Create(order).OrderItems; for (int i = 0; i < actual.Count; i++) { actual[i].Price.Should().Be(order.OrderItems[i].Price); } }
public static void Create_OrderItems_SetsCostPerYear(Order order) { var actual = OrderModel.Create(order).OrderItems; for (int i = 0; i < actual.Count; i++) { actual[i].CostPerYear.Should().Be(order.OrderItems[i].CalculateTotalCostPerYear()); } }
public static void Create_OrderItems_SetsCatalogueItemName(Order order) { var actual = OrderModel.Create(order); for (int i = 0; i < actual.OrderItems.Count; i++) { actual.OrderItems[i].CatalogueItemName.Should().Be(order.OrderItems[i].CatalogueItem.Name.ToString()); } }
public static void Create_OrderItems_SetsAllRecipientsFromOrder(Order order) { var actual = OrderModel.Create(order).OrderItems; for (int i = 0; i < actual.Count; i++) { actual[i].ServiceRecipients.Count.Should().Be(order.OrderItems[i].OrderItemRecipients.Count); } }
public async Task <ActionResult <OrderModel> > GetAsync(CallOffId callOffId) { var order = await orderService.GetOrder(callOffId); if (order is null) { return(NotFound()); } return(OrderModel.Create(order)); }
public static void Create_OrderItems_SetsQuantityPeriodDescription(Order order) { var actual = OrderModel.Create(order).OrderItems; for (int i = 0; i < actual.Count; i++) { actual[i] .QuantityPeriodDescription.Should() .Be(order.OrderItems[i].EstimationPeriod?.Description()); } }
public static void Create_OrderItems_Recipients_SetsQuantity(Order order) { var actual = OrderModel.Create(order).OrderItems; for (int i = 0; i < actual.Count; i++) { for (int j = 0; j < actual[i].ServiceRecipients.Count; j++) { actual[i] .ServiceRecipients[j] .Quantity.Should() .Be(order.OrderItems[i].OrderItemRecipients[j].Quantity); } } }
public static async Task GetAsync_OrderExists_ReturnsExpectedResult( [Frozen] Mock <IOrderService> service, [Frozen] CallOffId callOffId, OrderItem orderItem, Order order, OrdersController controller) { order.AddOrUpdateOrderItem(orderItem); service.Setup(o => o.GetOrder(callOffId)).ReturnsAsync(order); var expectedResult = OrderModel.Create(order); var response = await controller.GetAsync(callOffId); response.Value.Should().BeEquivalentTo(expectedResult); }
public static void Create_OrderItems_Recipients_SetsItemId(Order order) { var actual = OrderModel.Create(order).OrderItems; int count = 1; for (int i = 0; i < actual.Count; i++) { for (int j = 0; j < actual[i].ServiceRecipients.Count; j++) { actual[i] .ServiceRecipients[j] .ItemId.Should() .Be($"{order.CallOffId}-{order.OrderItems[i].OrderItemRecipients[j].Recipient.OdsCode}-{count}"); count++; } } }
public static void Create_OrderItems_Recipients_SetsCostPerYear(Order order) { var actual = OrderModel.Create(order).OrderItems; for (int i = 0; i < actual.Count; i++) { for (int j = 0; j < actual[i].ServiceRecipients.Count; j++) { var priceTimeUnit = order.OrderItems[i].ProvisioningType == ProvisioningType.OnDemand ? order.OrderItems[i].EstimationPeriod : order.OrderItems[i].PriceTimeUnit; actual[i] .ServiceRecipients[j] .CostPerYear.Should() .Be( order.OrderItems[i] .OrderItemRecipients[j] .CalculateTotalCostPerYear(order.OrderItems[i].Price ?? 0, priceTimeUnit)); } } }
public static void Create_ValidOrder_SetsTotalRecurringCostPerYear(Order order) { var actual = OrderModel.Create(order); actual.TotalRecurringCostPerYear.Should().Be(order.CalculateCostPerYear(CostType.Recurring)); }
public static void Create_ValidOrder_SetsTotalOneOffCost(Order order) { var actual = OrderModel.Create(order); actual.TotalOneOffCost.Should().Be(order.CalculateCostPerYear(CostType.OneOff)); }
public static void Create_ValidOrder_SetsSupplier(Order order) { var actual = OrderModel.Create(order); actual.Supplier.Should().BeEquivalentTo(new SupplierModel(order.Supplier, order.SupplierContact)); }
public static void Create_ValidOrder_SetsStatusName(Order order) { var actual = OrderModel.Create(order); actual.Status.Should().Be(order.OrderStatus.Name); }
public static void Create_OrderItems_CountSameAsForOrder(Order order) { var actual = OrderModel.Create(order); actual.OrderItems.Count.Should().Be(order.OrderItems.Count); }
public static void Create_ValidOrder_SetsDescription(Order order) { var actual = OrderModel.Create(order); actual.Description.Should().Be(order.Description); }
public static void Create_NullOrder_ThrowsException() { Assert.Throws <ArgumentNullException>(() => _ = OrderModel.Create(null)); }
public static void Create_ValidOrder_SetsDateCompleted(Order order) { var actual = OrderModel.Create(order); actual.DateCompleted.Should().Be(order.Completed); }
public static void Create_ValidOrder_SetsCommencementDate(Order order) { var actual = OrderModel.Create(order); actual.CommencementDate.Should().Be(order.CommencementDate); }