public void TestPartiallyFilledTruck() { //ARRANGE onSetUp(); var productA = AddSampleProduct("0001", 350000.0f, 10); var productB = AddSampleProduct("0002", 350000.0f, 10); var productC = AddSampleProduct("0003", 350000.0f, 10); var productD = AddSampleProduct("0004", 350000.0f, 10); var productE = AddSampleProduct("0005", 601000.0f, 10); var productId = productA.Id; var Gtin = productA.Gtin; var Weight = productA.Weight; var orderItems = new List <StockAlteration> { new StockAlteration(productA.Id, 1, productA.Weight, productA.Gtin), new StockAlteration(productB.Id, 1, productB.Weight, productB.Gtin), new StockAlteration(productC.Id, 1, productC.Weight, productC.Gtin), new StockAlteration(productD.Id, 1, productD.Weight, productD.Gtin), new StockAlteration(productE.Id, 1, productE.Weight, productE.Gtin) }; //Act var truckList = OutboundOrderController.TruckLoading(orderItems); //ASSERT Assert.AreEqual(2, truckList.Count); }
public void TestMultipleOrdersToSameTruck() { //ARRANGE onSetUp(); var productA = AddSampleProduct("0001", 350000.0f, 10); var productB = AddSampleProduct("0002", 350000.0f, 10); var productC = AddSampleProduct("0003", 350000.0f, 10); var productD = AddSampleProduct("0004", 350000.0f, 10); var productId = productA.Id; var Gtin = productA.Gtin; var Weight = productA.Weight; var orderItems = new List <StockAlteration> { new StockAlteration(productA.Id, 1, productA.Weight, productA.Gtin), new StockAlteration(productB.Id, 1, productB.Weight, productB.Gtin), new StockAlteration(productC.Id, 1, productC.Weight, productC.Gtin), new StockAlteration(productD.Id, 1, productD.Weight, productD.Gtin) }; //Act var truckList = OutboundOrderController.TruckLoading(orderItems); //ASSERT Assert.AreEqual(1, truckList.Count); Assert.AreEqual(4, truckList[0].ProductQuantityByIds.Count); Assert.AreEqual(1, truckList[0].ProductQuantityByIds[productA.Id]); Assert.AreEqual(1, truckList[0].ProductQuantityByIds[productB.Id]); Assert.AreEqual(1, truckList[0].ProductQuantityByIds[productC.Id]); Assert.AreEqual(1, truckList[0].ProductQuantityByIds[productD.Id]); }
public void TestTruckCantBeOverLoadedWithOneOrder() { //ARRANGE onSetUp(); var productA = new ProductBuilder().setGtin("0001").setWeight(2000000.0f).CreateProductDatabaseModel(); productRepository.AddProducts(new List <ProductDataModel>() { productA }); var productAID = new Product(productRepository.GetProductByGtin("0001")).Id; stockRepository.AddStock(WAREHOUSE_ID, new List <StockAlteration>() { new StockAlteration(productAID, 10, productA.Weight, productA.Gtin) }); var productId = productA.Id; var Gtin = productA.Gtin; var Weight = productA.Weight; var Quantity = 3; var orderItems = new List <StockAlteration>(); orderItems.Add(new StockAlteration(productId, Quantity, Weight, Gtin)); //Act var truckList = OutboundOrderController.TruckLoading(orderItems); //ASSERT //Expected Result = 3 trucks Assert.AreEqual(3, truckList.Count); }
public void TestNewTruckForEachOrder() { //ARRANGE onSetUp(); var productA = new ProductBuilder().setGtin("0001").setWeight(2000000.0f).CreateProductDatabaseModel(); productRepository.AddProducts(new List <ProductDataModel>() { productA }); var productAID = new Product(productRepository.GetProductByGtin("0001")).Id; stockRepository.AddStock(WAREHOUSE_ID, new List <StockAlteration>() { new StockAlteration(productAID, 10, productA.Weight, productA.Gtin) }); var productB = new ProductBuilder().setGtin("0002").setWeight(2000000.0f).CreateProductDatabaseModel(); productRepository.AddProducts(new List <ProductDataModel>() { productB }); var productBID = new Product(productRepository.GetProductByGtin("0002")).Id; stockRepository.AddStock(WAREHOUSE_ID, new List <StockAlteration>() { new StockAlteration(productBID, 10, productB.Weight, productB.Gtin) }); var productId = productA.Id; var Gtin = productA.Gtin; var Weight = productA.Weight; var orderItems = new List <StockAlteration> { new StockAlteration(productA.Id, 1, productA.Weight, productA.Gtin), new StockAlteration(productB.Id, 1, productB.Weight, productB.Gtin) }; //Act var truckList = OutboundOrderController.TruckLoading(orderItems); //ASSERT Assert.AreEqual(2, truckList.Count); Assert.AreEqual(1, truckList[0].ProductQuantityByIds.Count); Assert.AreEqual(1, truckList[0].ProductQuantityByIds[productA.Id]); Assert.AreEqual(1, truckList[1].ProductQuantityByIds.Count); Assert.AreEqual(1, truckList[1].ProductQuantityByIds[productB.Id]); }
public void TestProductNotSplitUneccessarily() { //ARRANGE onSetUp(); var productA = AddSampleProduct("0001", 1000.0f, 10); var productB = AddSampleProduct("0002", 1000.0f, 10); var productId = productA.Id; var Gtin = productA.Gtin; var Weight = productA.Weight; var orderItems = new List <StockAlteration> { new StockAlteration(productA.Id, 1000, productA.Weight, productA.Gtin), new StockAlteration(productB.Id, 1999, productB.Weight, productB.Gtin) }; //Act var truckList = OutboundOrderController.TruckLoading(orderItems); //ASSERT Assert.AreEqual(2, truckList.Count); Assert.AreEqual(1, truckList[0].ProductQuantityByIds.Count); Assert.AreEqual(1, truckList[1].ProductQuantityByIds.Count); }