public void Return_Zero_Cost_If_Part_Do_Not_Exists() { var partDescription = new PartDescription("Part A", "Dublin"); var inventory = new Inventory(); PartCost cost = inventory.PreviewCheckOut(partDescription, quantity: 2, priceStrategy: new FifoPriceStrategy()); cost.Total.Should().Be(0); }
public void Return_Cost_Having_One_Batch_And_Enough_Quantity_Of_That_Part() { const string partType = "Part A"; const string warehouse = "Dublin"; var partDescription = new PartDescription(partType, warehouse); var inventory = new Inventory(); var batch = new Batch(partType, partPrice: 100, quantity: 2); inventory.CheckIn(batch, warehouse); PartCost cost = inventory.PreviewCheckOut(partDescription, quantity: 2, priceStrategy: new FifoPriceStrategy()); cost.Total.Should().Be(200); }
public void Check_In_Parts() { const string partType = "Part A"; const string warehouse = "Dublin"; var partDescription = new PartDescription(partType, warehouse); var inventory = new Inventory(); var batch = new Batch(partType, partPrice: 100, quantity: 1); inventory.CheckIn(batch, warehouse); PartCost cost = inventory.PreviewCheckOut(partDescription, quantity: 1, priceStrategy: new FifoPriceStrategy()); cost.Total.Should().Be(100); }
public void Return_Cost_Having_Several_Batches_Of_That_Part_With_LIFO_Strategy() { const string partType = "Part A"; const string warehouse = "Dublin"; var partDescription = new PartDescription(partType, warehouse); var inventory = new Inventory(); var batch1 = new Batch(partType, partPrice: 100, quantity: 2); var batch2 = new Batch(partType, partPrice: 150, quantity: 4); inventory.CheckIn(batch1, warehouse); inventory.CheckIn(batch2, warehouse); PartCost cost = inventory.PreviewCheckOut(partDescription, quantity: 5, priceStrategy: new LifoPriceStrategy()); cost.Total.Should().Be(700); }