コード例 #1
0
ファイル: Supplier.cs プロジェクト: johnnonolan/the-beer-game
 public FurthestDownStream(Supplier upstreamSupplier)
 {
     _upstreamSupplier = upstreamSupplier;
     Inventory = 15;
     UnfulfilledOrders = 5;
        // ShippingDelays = 0;
 }
コード例 #2
0
ファイル: Supplier.cs プロジェクト: johnnonolan/the-beer-game
 public Supplier(Supplier upstreamSupplier)
 {
     _upstreamSupplier = upstreamSupplier ?? EmptySupplier();
     Inventory = 15;
     UnfulfilledOrders = 5;
     ShippingDelays = 5;
 }
コード例 #3
0
        public void ShouldReduceInventory()
        {
            var supplier = new Supplier(null);
            var inventory = supplier.Inventory+supplier.UnfulfilledOrders;
            supplier.SetOrder(inventory);

            Assert.Equal(0,supplier.Inventory);
        }
コード例 #4
0
ファイル: Game.cs プロジェクト: johnnonolan/the-beer-game
 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;
 }
コード例 #5
0
        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);
        }
コード例 #6
0
        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);
        }
コード例 #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);
 }
コード例 #8
0
 // ReSharper restore UnusedParameter.Local
 // ReSharper disable UnusedParameter.Local
 static void CheckSupplyChainMembersAreInitialised(Supplier supplier)
 {
     CheckSupplyChainMembersAreInitialised(supplier, supplier is FurthestDownStream);
 }