public static void Constructor_InitializesType(
            [Frozen] CataloguePriceType priceType,
            OrderItem orderItem)
        {
            var model = new GetOrderItemModel(orderItem);

            model.Type.Should().Be(priceType.ToString());
        }
        public static void Constructor_InitializesServiceRecipients(
            [Frozen] IEnumerable <OrderItemRecipient> recipients,
            OrderItem orderItem)
        {
            var model = new GetOrderItemModel(orderItem);

            model.ServiceRecipients.Should().BeEquivalentTo(recipients.ToList().ToModelList());
        }
        public static void Constructor_InitializesEstimationPeriod(
            [Frozen] TimeUnit estimationPeriod,
            OrderItem orderItem)
        {
            var model = new GetOrderItemModel(orderItem);

            model.EstimationPeriod.Should().Be(estimationPeriod.Name());
        }
        public static void Constructor_InitializesProvisioningType(
            [Frozen] ProvisioningType provisioningType,
            OrderItem orderItem)
        {
            var model = new GetOrderItemModel(orderItem);

            model.ProvisioningType.Should().Be(provisioningType.ToString());
        }
        public static void Constructor_InitializesItemUnit(
            [Frozen] PricingUnit priceUnit,
            OrderItem orderItem)
        {
            var model = new GetOrderItemModel(orderItem);

            model.ItemUnit.Should().NotBeNull();
            model.ItemUnit.Description.Should().Be(priceUnit.Description);
            model.ItemUnit.Name.Should().Be(priceUnit.Name);
        }
        public static void Constructor_InitializesTimeUnit(
            [Frozen] TimeUnit timeUnit,
            OrderItem orderItem)
        {
            var model = new GetOrderItemModel(orderItem);

            model.TimeUnit.Should().NotBeNull();
            model.TimeUnit.Description.Should().Be(timeUnit.Description());
            model.TimeUnit.Name.Should().Be(timeUnit.Name());
        }
Esempio n. 7
0
        public async Task <CustomResponse> Get(Guid id)
        {
            OrderItemDto orderItem = await _unitOfWork.OrderItemRepository.FindAsync(id);

            if (orderItem == null)
            {
                return(_responsMessages.OrderItemNotFound);
            }

            GetOrderItemModel model = _mapper.Map <GetOrderItemModel>(orderItem);

            return(new OkResponse(model));
        }
Esempio n. 8
0
        public static async Task GetAsync_OrderItemExists_ReturnsExpected(
            [Frozen] Mock <IOrderItemService> service,
            [Frozen] CallOffId callOffId,
            [Frozen] CatalogueItemId catalogueItemId,
            OrderItem orderItem,
            Order order,
            OrderItemsController controller)
        {
            order.AddOrUpdateOrderItem(orderItem);

            service.Setup(o => o.GetOrderItem(callOffId, catalogueItemId)).ReturnsAsync(orderItem);

            var expectedValue = new GetOrderItemModel(orderItem);

            var response = await controller.GetAsync(callOffId, catalogueItemId);

            response.Value.Should().BeEquivalentTo(expectedValue);
        }
        public async Task ThenTheCatalogueSolutionsResponseContainsASingleSolution(Table table)
        {
            var expected = table.CreateSet <GetOrderItemModel>().FirstOrDefault();

            var response = await _response.ReadBodyAsJsonAsync();

            var actual = new GetOrderItemModel
            {
                ServiceRecipientOdsCode = response.SelectToken("serviceRecipient").Value <string>("odsCode"),
                CatalogueSolutionId     = response.Value <string>("catalogueSolutionId"),
                CatalogueSolutionName   = response.Value <string>("catalogueSolutionName"),
                CurrencyCode            = response.Value <string>("currencyCode"),
                DeliveryDate            = response.Value <DateTime?>("deliveryDate"),
                EstimationPeriod        = response.Value <string>("estimationPeriod"),
                ItemUnitDescription     = response.SelectToken("itemUnit").Value <string>("description"),
                ItemUnitName            = response.SelectToken("itemUnit").Value <string>("name"),
                Price            = response.Value <decimal?>("price"),
                ProvisioningType = response.Value <string>("provisioningType"),
                Quantity         = response.Value <int>("quantity"),
                Type             = response.Value <string>("type")
            };

            actual.Should().BeEquivalentTo(expected);
        }
        public static void Constructor_InitializesPrice(OrderItem orderItem)
        {
            var model = new GetOrderItemModel(orderItem);

            model.Price.Should().Be(orderItem.Price);
        }
        public static void Constructor_InitializesCurrencyCode(OrderItem orderItem)
        {
            var model = new GetOrderItemModel(orderItem);

            model.CurrencyCode.Should().Be(orderItem.CurrencyCode);
        }
        public static void Constructor_InitializesCatalogueItemId(OrderItem orderItem)
        {
            var model = new GetOrderItemModel(orderItem);

            model.CatalogueItemId.Should().Be(orderItem.CatalogueItem.Id.ToString());
        }
        public static void Constructor_InitializesCatalogueItemName(OrderItem orderItem)
        {
            var model = new GetOrderItemModel(orderItem);

            model.CatalogueItemName.Should().Be(orderItem.CatalogueItem.Name);
        }
 public static void Constructor_NullOrderItem_ThrowsArgumentNullException()
 {
     Assert.Throws <ArgumentNullException>(() => _ = new GetOrderItemModel(null));
 }