Esempio n. 1
0
 public FurthestDownStream(Supplier upstreamSupplier)
 {
     _upstreamSupplier = upstreamSupplier;
     Inventory = 15;
     UnfulfilledOrders = 5;
        // ShippingDelays = 0;
 }
Esempio n. 2
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);
        }
Esempio n. 4
0
 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);
        }
Esempio n. 7
0
 // 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);
 }
Esempio n. 8
0
 // ReSharper restore UnusedParameter.Local
 // ReSharper disable UnusedParameter.Local
 static void CheckSupplyChainMembersAreInitialised(Supplier supplier)
 {
     CheckSupplyChainMembersAreInitialised(supplier, supplier is FurthestDownStream);
 }