public void ShouldNotAddNewRecordsIfProductPreOrderableInformationIsNotFound() { // Arrange var request = new GetPreOrderableInformationRequest("shopname", new List <InventoryProduct> { new InventoryProduct { ProductId = "noExist" } }); var result = new GetPreOrderableInformationResult(); var args = new ServicePipelineArgs(request, result); var results = new OrderableInformationModel[1]; results[0] = null; this._client.GetPreOrderableInformationList("shopname", Arg.Is <string[]>(ids => (ids.Length == 1) && (ids[1] == "noExist")), new System.Guid()).Returns(results); // Act this._processor.Process(args); // Assert result.OrderableInformation.Should().HaveCount(1); result.OrderableInformation.ElementAt(0).Product.ProductId.Should().Be("noExist"); result.OrderableInformation.ElementAt(0).Status.Should().Be(null); result.OrderableInformation.ElementAt(0).InStockDate.Should().Be(null); result.OrderableInformation.ElementAt(0).OrderableEndDate.Should().Be(null); result.OrderableInformation.ElementAt(0).OrderableStartDate.Should().Be(null); result.OrderableInformation.ElementAt(0).RemainingQuantity.Should().Be(0); result.OrderableInformation.ElementAt(0).ShippingDate.Should().Be(null); result.OrderableInformation.ElementAt(0).CartQuantityLimit.Should().Be(0); }
/// <summary> /// Maps orderable information from model. /// </summary> /// <param name="orderableInfo">The orderable information.</param> /// <param name="orderableInfoModel">The orderable information model.</param> public static void MapOrderableInformationFromModel([NotNull] this OrderableInformation orderableInfo, [NotNull] OrderableInformationModel orderableInfoModel) { Assert.ArgumentNotNull(orderableInfo, "orderableInfo"); Assert.ArgumentNotNull(orderableInfoModel, "orderableInfoModel"); orderableInfo.CartQuantityLimit = orderableInfoModel.CartQuantityLimit; orderableInfo.InStockDate = orderableInfoModel.InStockDate; orderableInfo.OrderableEndDate = orderableInfoModel.OrderableEndDate; orderableInfo.OrderableStartDate = orderableInfoModel.OrderableStartDate; orderableInfo.RemainingQuantity = orderableInfoModel.RemainingQuantity; orderableInfo.ShippingDate = orderableInfoModel.ShippingDate; orderableInfo.Status = new StockStatus((int)orderableInfoModel.Status, orderableInfoModel.Status.ToString()); }