public FurthestDownStream(Supplier upstreamSupplier) { _upstreamSupplier = upstreamSupplier; Inventory = 15; UnfulfilledOrders = 5; // ShippingDelays = 0; }
public Supplier(Supplier upstreamSupplier) { _upstreamSupplier = upstreamSupplier ?? EmptySupplier(); Inventory = 15; UnfulfilledOrders = 5; ShippingDelays = 5; }
public void ShouldReduceInventory() { var supplier = new Supplier(null); var inventory = supplier.Inventory+supplier.UnfulfilledOrders; supplier.SetOrder(inventory); Assert.Equal(0,supplier.Inventory); }
public Game(IEnumerable<int> orders) { GameId = Guid.NewGuid(); Factory = new Supplier(null); Distributor= new Supplier(Factory); Wholesaler = new Supplier(Distributor); Retailer = new FurthestDownStream(Wholesaler); Week = 1; }
public void ShouldAddOverOrdersToUnFulfilled() { var supplier = new Supplier(null); var inventory = supplier.Inventory; var unfulfilledOrders = supplier.UnfulfilledOrders; supplier.SetOrder(inventory-unfulfilledOrders+5); Assert.Equal(5,supplier.UnfulfilledOrders); }
public void OrdersShouldAddToBufferToGoDownStream() { var upstream = new Supplier(null); var shippingDelays = upstream.ShippingDelays; var downstream = new Supplier(upstream); var upStreamUnfullfilled = upstream.UnfulfilledOrders; downstream.OrderFromUpStream(1); Assert.Equal(shippingDelays+upStreamUnfullfilled+1, upstream.ShippingDelays); }
// ReSharper restore UnusedParameter.Local static void CheckSupplyChainMembersAreInitialised(Supplier supplier, bool furthestDownStream) { Assert.Equal(supplier.Inventory, 15); Assert.Equal(supplier.UnfulfilledOrders, 5); var expected = 5; if (furthestDownStream) { expected = 0; } Assert.Equal(supplier.ShippingDelays, expected); }
// ReSharper restore UnusedParameter.Local // ReSharper disable UnusedParameter.Local static void CheckSupplyChainMembersAreInitialised(Supplier supplier) { CheckSupplyChainMembersAreInitialised(supplier, supplier is FurthestDownStream); }