public void Returns_non_succesful_result_if_any_Items_received_have_a_Quantity_not_greater_than_0() { //Arrange var chileProductKey = new ChileProductKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <ChileProduct>(c => c.EmptyProduct().ChileState = ChileStateEnum.Dehydrated)); var dehydratorKey = new CompanyKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <Company>(c => c.SetCompanyTypes(CompanyType.Dehydrator))); var packagingProductKey0 = new PackagingProductKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <PackagingProduct>()); var warehouseLocationKey0 = new LocationKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <Location>()); //Act var result = Service.CreateChileMaterialsReceived(new ChileMaterialsReceivedParameters { UserToken = TestUser.UserName, DateReceived = new DateTime(2012, 3, 29), ChileProductKey = chileProductKey, SupplierKey = dehydratorKey, TreatmentKey = StaticInventoryTreatments.NoTreatment.ToInventoryTreatmentKey(), Items = new List <ChileMaterialsReceivedItemParameters> { new ChileMaterialsReceivedItemParameters { Quantity = 0, Variety = "variety", PackagingProductKey = packagingProductKey0.KeyValue, LocationKey = warehouseLocationKey0.KeyValue } } }); //Assert result.AssertNotSuccess(UserMessages.QuantityNotGreaterThanZero); }
public void Creates_new_Inventory_record_as_expected_if_Adjustment_quantity_is_positive_and_Inventory_record_does_not_previously_exist() { //Arrange const int adjustmentQuantity = 12; const string toteKey = ""; var userToken = TestUser.UserName; var lotKey = new LotKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <Lot>(l => l.EmptyLot())); var packagingProductKey = new PackagingProductKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <PackagingProduct>()); var warehouseLocationKey = new LocationKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <Location>()); var treatmentKey = new InventoryTreatmentKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <InventoryTreatment>()); var inventoryKey = new InventoryKey(lotKey, packagingProductKey, warehouseLocationKey, treatmentKey, toteKey); //Act var result = Service.CreateInventoryAdjustment(new Params { UserToken = userToken, InventoryAdjustments = new List <IInventoryAdjustmentParameters> { new Params.ParamsItem(inventoryKey) { Adjustment = adjustmentQuantity } } }); //Assert result.AssertSuccess(); Assert.AreEqual(adjustmentQuantity, RVCUnitOfWork.InventoryRepository.FindByKey(inventoryKey).Quantity); }
internal static IResult <ReceiveInventoryParameters> ToParsedParameters(this IReceiveInventoryParameters parameters) { if (parameters == null) { throw new ArgumentNullException("parameters"); } var productKeyResult = KeyParserHelper.ParseResult <IProductKey>(parameters.ProductKey); if (!productKeyResult.Success) { return(productKeyResult.ConvertTo <ReceiveInventoryParameters>()); } var productKey = productKeyResult.ResultingObject.ToProductKey(); PackagingProductKey packagingKey = null; if (!string.IsNullOrWhiteSpace(parameters.PackagingReceivedKey)) { var packagingKeyResult = KeyParserHelper.ParseResult <IPackagingProductKey>(parameters.PackagingReceivedKey); if (!packagingKeyResult.Success) { return(packagingKeyResult.ConvertTo <ReceiveInventoryParameters>()); } packagingKey = packagingKeyResult.ResultingObject.ToPackagingProductKey(); } CompanyKey vendorKey = null; if (!string.IsNullOrWhiteSpace(parameters.VendorKey)) { var vendorKeyResult = KeyParserHelper.ParseResult <ICompanyKey>(parameters.VendorKey); if (!vendorKeyResult.Success) { return(vendorKeyResult.ConvertTo <ReceiveInventoryParameters>()); } vendorKey = vendorKeyResult.ResultingObject.ToCompanyKey(); } var items = new List <ReceiveInventoryItemParameters>(); foreach (var item in parameters.Items) { var parsedItem = item.ToParsedParameters(); if (!parsedItem.Success) { return(parsedItem.ConvertTo <ReceiveInventoryParameters>()); } items.Add(parsedItem.ResultingObject); } return(new SuccessResult <ReceiveInventoryParameters>(new ReceiveInventoryParameters { Parameters = parameters, ProductKey = productKey, PackagingReceivedKey = packagingKey, VendorKey = vendorKey, Items = items })); }
public void Returns_non_successful_result_if_any_Quantity_is_less_than_or_equal_to_0() { //Arrange const int quantity = 0; var orderKey = CreateKeyFromOrder(TestHelper.CreateObjectGraphAndInsertIntoDatabase <TOrder>(InitializeOrder, o => o.InventoryPickOrder.Items = new List <InventoryPickOrderItem> { TestHelper.CreateObjectGraph <InventoryPickOrderItem>(i => i.InventoryPickOrder = null), TestHelper.CreateObjectGraph <InventoryPickOrderItem>(i => i.InventoryPickOrder = null), TestHelper.CreateObjectGraph <InventoryPickOrderItem>(i => i.InventoryPickOrder = null) })); var chileProductKey = new ChileProductKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <ChileProduct>()).KeyValue; var packagingProductKey = new PackagingProductKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <PackagingProduct>()).KeyValue; var treatmentKey = new InventoryTreatmentKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <InventoryTreatment>()).KeyValue; Assert.IsNotEmpty(RVCUnitOfWork.InventoryPickOrderItemRepository.All()); //Act var result = GetResult(new SetInventoryPickOrderParameters(orderKey.KeyValue) { UserToken = TestUser.UserName, InventoryPickOrderItems = new List <ISetInventoryPickOrderItemParameters> { new SetInventoryPickOrderItemParameters { ProductKey = chileProductKey, PackagingKey = packagingProductKey, TreatmentKey = treatmentKey, Quantity = quantity } } }); //Assert result.AssertNotSuccess(); }
private IResult <Lot> CreatePackagingLot(DateTime timeStamp, IEmployeeKey employeeKey, ReceiveInventoryParameters parameters) { var packagingProductKey = PackagingProductKey.FromProductKey(parameters.ProductKey); var packagingProduct = _inventoryUnitOfWork.PackagingProductRepository.FindByKey(packagingProductKey); if (packagingProduct == null) { return(new InvalidResult <Lot>(null, string.Format(UserMessages.PackagingProductNotFound, packagingProductKey.KeyValue))); } var packagingLotResult = new CreateNewPackagingLotCommand(_inventoryUnitOfWork).Execute(new CreateNewPackagingLotCommandParameters { EmployeeKey = employeeKey, TimeStamp = timeStamp, PackagingProductKey = packagingProduct, PackagingReceivedKey = parameters.PackagingReceivedKey, LotType = parameters.Parameters.LotType, LotDate = parameters.Parameters.LotDate?.Date ?? timeStamp, LotSequence = parameters.Parameters.LotSequence, VendorKey = parameters.VendorKey, PurchaseOrderNumber = parameters.Parameters.PurchaseOrderNumber, ShipperNumber = parameters.Parameters.ShipperNumber }); return(!packagingLotResult.Success ? packagingLotResult.ConvertTo <Lot>() : new SuccessResult <Lot>(packagingLotResult.ResultingObject.Lot)); }
public void Creates_DehydratedMaterialsReceived_record_as_expected_on_success() { //Arrange var expectedLotDate = new DateTime(2012, 3, 29); const int expectedLotDateSequence = 1; const int expectedLotTypeId = (int)LotTypeEnum.DeHydrated; const string expectedLoad = "123"; const string expectedPurchaseOrder = "MLAH!"; const string expectedShipperNumber = "1029384756"; var chileProductKey = new ChileProductKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <ChileProduct>(c => c.EmptyProduct().ChileState = ChileStateEnum.Dehydrated)); var packagingProductKey = new PackagingProductKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <PackagingProduct>()); var locationKey = new LocationKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <Location>()); var supplierKey = new CompanyKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <Company>(c => c.SetCompanyTypes(CompanyType.Dehydrator))); //Act var result = Service.CreateChileMaterialsReceived(new ChileMaterialsReceivedParameters { ChileMaterialsReceivedType = ChileMaterialsReceivedType.Dehydrated, UserToken = TestUser.UserName, DateReceived = expectedLotDate, ChileProductKey = chileProductKey, SupplierKey = supplierKey, TreatmentKey = StaticInventoryTreatments.NoTreatment.ToInventoryTreatmentKey(), LoadNumber = expectedLoad, PurchaseOrder = expectedPurchaseOrder, ShipperNumber = expectedShipperNumber, Items = new List <ChileMaterialsReceivedItemParameters> { new ChileMaterialsReceivedItemParameters { Quantity = 10, PackagingProductKey = packagingProductKey, LocationKey = locationKey, Variety = "Variety" } } }); //Assert result.AssertSuccess(); var received = RVCUnitOfWork.ChileMaterialsReceivedRepository.Filter(d => true, d => d.ChileLot.Lot, d => d.Items).Single(); Assert.AreEqual(expectedLotDate, received.LotDateCreated); Assert.AreEqual(expectedLotDateSequence, received.LotDateSequence); Assert.AreEqual(expectedLotTypeId, received.LotTypeId); Assert.AreEqual(expectedLoad, received.LoadNumber); Assert.AreEqual(expectedPurchaseOrder, received.ChileLot.Lot.PurchaseOrderNumber); Assert.AreEqual(expectedShipperNumber, received.ChileLot.Lot.ShipperNumber); Assert.IsNotNull(received.ChileLot); Assert.IsNotNull(received.Items.SingleOrDefault()); }
public void Will_successfully_create_an_InventoryPickOrderItem_with_null_Treatment() { //Arrange var order = TestHelper.CreateObjectGraphAndInsertIntoDatabase <TOrder>(InitializeOrder, o => GetPickOrderFromOrder(o).Items = null); var orderKey = CreateKeyFromOrder(order); TestHelper.CreateObjectGraphAndInsertIntoDatabase <InventoryPickOrderItem>(i => i.InventoryPickOrder = null, i => ConstrainItemToOrder(i, GetPickOrderFromOrder(order))); var chileProductKey0 = new ChileProductKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <ChileProduct>()).KeyValue; var packagingProductKey0 = new PackagingProductKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <PackagingProduct>()).KeyValue; const int expectedQuantity0 = 10; var chileProductKey1 = new ChileProductKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <ChileProduct>()).KeyValue; var packagingProductKey1 = new PackagingProductKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <PackagingProduct>()).KeyValue; const int expectedQuantity1 = 20; //Act var testParams = new SetInventoryPickOrderParameters(orderKey.KeyValue) { UserToken = TestUser.UserName, InventoryPickOrderItems = new List <ISetInventoryPickOrderItemParameters> { new SetInventoryPickOrderItemParameters { ProductKey = chileProductKey0, PackagingKey = packagingProductKey0, TreatmentKey = null, Quantity = expectedQuantity0 }, new SetInventoryPickOrderItemParameters { ProductKey = chileProductKey1, PackagingKey = packagingProductKey1, TreatmentKey = null, Quantity = expectedQuantity1 } } }; var result = GetResult(testParams); //Assert result.AssertSuccess(); var items = RVCUnitOfWork.InventoryPickOrderRepository.Filter(i => true, i => i.Items.Select(m => m.InventoryTreatment)).Single().Items.ToList(); Assert.AreEqual(testParams.InventoryPickOrderItems.Count(), items.Count); testParams.InventoryPickOrderItems.ForEach(i => items.Single(r => i.ProductKey == new ProductKey((IProductKey)r).KeyValue&& i.PackagingKey == new PackagingProductKey(r).KeyValue&& r.TreatmentId == 0 && i.Quantity == r.Quantity)); }
internal static Expression <Func <InventoryTransaction, bool> > ByInventoryKey(IInventoryKey inventoryKey) { var lot = new LotKey(inventoryKey).FindByPredicate; var location = new LocationKey(inventoryKey).FindByPredicate; var packaging = new PackagingProductKey(inventoryKey).FindByPredicate; var treatment = new InventoryTreatmentKey(inventoryKey).FindByPredicate; return(Projector <InventoryTransaction> .To(i => lot.Invoke(i.SourceLot) && location.Invoke(i.Location) && packaging.Invoke(i.PackagingProduct) && treatment.Invoke(i.Treatment) && i.ToteKey == inventoryKey.InventoryKey_ToteKey)); }
public void Creates_a_single_Inventory_record_with_aggregate_Quantity_for_Items_received_that_reference_the_same_Packaging_WarehouseLocation() { //Arrange var expectedLotDate = new DateTime(2012, 3, 29); const int expectedLotDateSequence = 1; const int expectedLotTypeId = (int)LotTypeEnum.DeHydrated; const int quantity0 = 10; const int quantity1 = 21; const int expectedQuantity = quantity0 + quantity1; var chileProductKey = new ChileProductKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <ChileProduct>(c => c.EmptyProduct().ChileState = ChileStateEnum.Dehydrated)); var dehydratorKey = new CompanyKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <Company>(c => c.SetCompanyTypes(CompanyType.Dehydrator))); var packagingProductKey = new PackagingProductKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <PackagingProduct>()); var warehouseLocationKey = new LocationKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <Location>()); //Act var result = Service.CreateChileMaterialsReceived(new ChileMaterialsReceivedParameters { UserToken = TestUser.UserName, DateReceived = expectedLotDate, ChileProductKey = chileProductKey.KeyValue, SupplierKey = dehydratorKey.KeyValue, TreatmentKey = StaticInventoryTreatments.NoTreatment.ToInventoryTreatmentKey(), Items = new List <ChileMaterialsReceivedItemParameters> { new ChileMaterialsReceivedItemParameters { Quantity = quantity0, Variety = "Variety", PackagingProductKey = packagingProductKey.KeyValue, LocationKey = warehouseLocationKey.KeyValue }, new ChileMaterialsReceivedItemParameters { Quantity = quantity1, Variety = "Variety", PackagingProductKey = packagingProductKey.KeyValue, LocationKey = warehouseLocationKey.KeyValue } } }); //Assert result.AssertSuccess(); var inventory = RVCUnitOfWork.InventoryRepository.All().Single(i => i.LotDateCreated == expectedLotDate && i.LotDateSequence == expectedLotDateSequence && i.LotTypeId == expectedLotTypeId); Assert.AreEqual(expectedQuantity, inventory.Quantity); }
internal LotPackagingKeyValueQuantity(ILotKey lot, IPackagingProductKey packaging, int quantity) { var lotKey = new LotKey(lot); LotKeyValue = lotKey.KeyValue; LotPredicateExpression = lotKey.FindByPredicate; LotPredicate = lotKey.FindByPredicate.Compile(); var packagingKey = new PackagingProductKey(packaging); PackagingKeyValue = packagingKey.KeyValue; PackagingPredicateExpression = packagingKey.FindByPredicate; PackagingPredicate = packagingKey.FindByPredicate.Compile(); Quantity = quantity; }
public void Returns_successful_result_if_ProductionDate_has_a_time_component_and_a_Lot_exists_with_the_same_Date_Type_and_a_Sequence_of_1() { //Arrange var productionDate = new DateTime(2012, 4, 1, 10, 30, 21); TestHelper.CreateObjectGraphAndInsertIntoDatabase <ChileLot>(c => c.LotDateCreated = productionDate, c => c.LotDateSequence = 1, c => c.LotTypeId = (int)LotTypeEnum.DeHydrated); var chileProductKey = new ChileProductKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <ChileProduct>(c => c.EmptyProduct().ChileState = ChileStateEnum.Dehydrated)); var packagingProductKey = new PackagingProductKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <PackagingProduct>()); var warehouseLocationKey = new LocationKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <Location>()); var dehydratorKey = new CompanyKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <Company>(c => c.SetCompanyTypes(CompanyType.Dehydrator))); //Act var result = Service.CreateChileMaterialsReceived(new ChileMaterialsReceivedParameters { UserToken = TestUser.UserName, DateReceived = productionDate, ChileProductKey = chileProductKey, SupplierKey = dehydratorKey, TreatmentKey = StaticInventoryTreatments.NoTreatment.ToInventoryTreatmentKey(), LoadNumber = "123", PurchaseOrder = "POPO", ShipperNumber = "1029384756", Items = new List <ChileMaterialsReceivedItemParameters> { new ChileMaterialsReceivedItemParameters { Quantity = 10, PackagingProductKey = packagingProductKey.KeyValue, LocationKey = warehouseLocationKey.KeyValue, Variety = "variety" } } }); //Assert result.AssertSuccess(); }
public void Creates_Lot_record_with_LotProductionStatus_set_to_Produced() { //Arrange var chileProductKey = new ChileProductKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <ChileProduct>(c => c.EmptyProduct().ChileState = ChileStateEnum.Dehydrated)); var packagingProductKey = new PackagingProductKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <PackagingProduct>()); var warehouseLocationKey = new LocationKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <Location>()); var dehydratorKey = new CompanyKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <Company>(c => c.SetCompanyTypes(CompanyType.Dehydrator))); //Act var result = Service.CreateChileMaterialsReceived(new ChileMaterialsReceivedParameters { UserToken = TestUser.UserName, DateReceived = new DateTime(2012, 3, 29), ChileProductKey = chileProductKey, SupplierKey = dehydratorKey, TreatmentKey = StaticInventoryTreatments.NoTreatment.ToInventoryTreatmentKey(), LoadNumber = "123", PurchaseOrder = "MLAH!", ShipperNumber = "1029384756", Items = new List <ChileMaterialsReceivedItemParameters> { new ChileMaterialsReceivedItemParameters { Quantity = 10, PackagingProductKey = packagingProductKey.KeyValue, LocationKey = warehouseLocationKey.KeyValue, Variety = "Variety" } } }); //Assert result.AssertSuccess(); var dehydratedReceived = RVCUnitOfWork.ChileMaterialsReceivedRepository.Filter(d => true, d => d.ChileLot.Lot, d => d.Items).Single(); Assert.AreEqual(LotProductionStatus.Produced, dehydratedReceived.ChileLot.Lot.ProductionStatus); }
internal void Initialize() { var pickedItems = PickedItemSelect.GroupBy(i => new { productKey = i.LotSelect.ProductKey, packagingKey = new PackagingProductKey(i.Item), treatmentKey = new InventoryTreatmentKey(i.Item) }, i => i.Item.Quantity) .ToDictionary(g => g.Key, g => g.Sum()); foreach (var item in Items.Cast <PendingPickOrderItem>()) { var productKey = new ProductKey((IProductKey)item.DataModel); var packagingKey = new PackagingProductKey(item.DataModel); var treatmentKey = new InventoryTreatmentKey(item.DataModel); var noMatch = false; while (item.QuantityPicked < item.QuantityOrdered && !noMatch) { var key = pickedItems.Keys.FirstOrDefault(k => k.productKey.Equals(productKey) && k.packagingKey.Equals(packagingKey) && k.treatmentKey.Equals(treatmentKey)); if (key == null) { noMatch = true; } else { var pick = Math.Min(pickedItems[key], item.QuantityOrdered - item.QuantityPicked); item.QuantityPicked += pick; pickedItems[key] -= pick; if (pickedItems[key] == 0) { pickedItems.Remove(key); } } } } }
public void Returns_non_successful_result_if_Dehydrator_Company_is_not_of_CompanyType_Dehydrator() { //Arrange var chileProductKey = new ChileProductKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <ChileProduct>(c => c.EmptyProduct().ChileState = ChileStateEnum.Dehydrated)); var packagingProductKey = new PackagingProductKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <PackagingProduct>()); var warehouseLocationKey = new LocationKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <Location>()); var supplier = TestHelper.CreateObjectGraphAndInsertIntoDatabase <Company>(c => c.SetCompanyTypes(CompanyType.Supplier)); //Act var result = Service.CreateChileMaterialsReceived(new ChileMaterialsReceivedParameters { ChileMaterialsReceivedType = ChileMaterialsReceivedType.Dehydrated, UserToken = TestUser.UserName, DateReceived = new DateTime(2012, 3, 29), ChileProductKey = chileProductKey, SupplierKey = supplier.ToCompanyKey(), TreatmentKey = StaticInventoryTreatments.NoTreatment.ToInventoryTreatmentKey(), LoadNumber = "123", PurchaseOrder = "MLAH!", ShipperNumber = "1029384756", Items = new List <ChileMaterialsReceivedItemParameters> { new ChileMaterialsReceivedItemParameters { Quantity = 10, PackagingProductKey = packagingProductKey.KeyValue, LocationKey = warehouseLocationKey.KeyValue, Variety = "Variety" } } }); //Assert result.AssertNotSuccess(string.Format(UserMessages.CompanyNotOfType, "{0}", "{1}", CompanyType.Dehydrator)); }
public void Creates_Inventory_records_as_expected_on_success() { //Arrange var expectedLotDate = new DateTime(2012, 3, 29); const int expectedLotDateSequence = 1; const int expectedLotTypeId = (int)LotTypeEnum.DeHydrated; const int expectedItems = 3; const int quantity0 = 10; const int quantity1 = 21; const int quantity2 = 40001; const string toteKey0 = "tote0"; const string toteKey1 = "tote-1"; const string toteKey2 = ""; const string varietyKey0 = "variety0"; const string varietyKey1 = "variety1"; var chileProductKey = new ChileProductKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <ChileProduct>(c => c.EmptyProduct().ChileState = ChileStateEnum.Dehydrated)); var dehydratorKey = new CompanyKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <Company>(c => c.SetCompanyTypes(CompanyType.Dehydrator))); var packagingProductKey0 = new PackagingProductKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <PackagingProduct>()); var packagingProductKey1 = new PackagingProductKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <PackagingProduct>()); var warehouseLocationKey0 = new LocationKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <Location>()); var warehouseLocationKey1 = new LocationKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <Location>()); //Act var result = Service.CreateChileMaterialsReceived(new ChileMaterialsReceivedParameters { UserToken = TestUser.UserName, DateReceived = expectedLotDate, ChileProductKey = chileProductKey.KeyValue, SupplierKey = dehydratorKey.KeyValue, TreatmentKey = StaticInventoryTreatments.NoTreatment.ToInventoryTreatmentKey(), Items = new List <ChileMaterialsReceivedItemParameters> { new ChileMaterialsReceivedItemParameters { Quantity = quantity0, Variety = varietyKey0, PackagingProductKey = packagingProductKey0.KeyValue, LocationKey = warehouseLocationKey0.KeyValue, ToteKey = toteKey0 }, new ChileMaterialsReceivedItemParameters { Quantity = quantity1, Variety = varietyKey0, PackagingProductKey = packagingProductKey1.KeyValue, LocationKey = warehouseLocationKey0.KeyValue, ToteKey = toteKey1 }, new ChileMaterialsReceivedItemParameters { Quantity = quantity2, Variety = varietyKey1, PackagingProductKey = packagingProductKey0.KeyValue, LocationKey = warehouseLocationKey1.KeyValue, ToteKey = toteKey2 } } }); //Assert result.AssertSuccess(); var inventory = RVCUnitOfWork.InventoryRepository.Filter(i => i.LotDateCreated == expectedLotDate && i.LotDateSequence == expectedLotDateSequence && i.LotTypeId == expectedLotTypeId).ToList(); Assert.AreEqual(expectedItems, inventory.Count); var item = inventory.Single(i => i.Quantity == quantity0); Assert.IsTrue(packagingProductKey0.Equals(item)); Assert.IsTrue(warehouseLocationKey0.Equals(item)); Assert.IsTrue(NoTreatmentKey.Equals(item)); Assert.AreEqual(toteKey0, item.ToteKey); item = inventory.Single(i => i.Quantity == quantity1); Assert.IsTrue(packagingProductKey1.Equals(item)); Assert.IsTrue(warehouseLocationKey0.Equals(item)); Assert.IsTrue(NoTreatmentKey.Equals(item)); Assert.AreEqual(toteKey1, item.ToteKey); item = inventory.Single(i => i.Quantity == quantity2); Assert.IsTrue(packagingProductKey0.Equals(item)); Assert.IsTrue(warehouseLocationKey1.Equals(item)); Assert.IsTrue(NoTreatmentKey.Equals(item)); Assert.AreEqual(toteKey2, item.ToteKey); }