public void ShouldForConwipHandleProcessingTimeOfZeroForPooledMachine()
        {
            WorkProcess process = new WorkProcess(new InfiniteBacklog());

            WipTokenPool wipLimit = new WipTokenPool(5);

            WorkStation ws1 = new WorkStation(wipLimit);
            WorkStation ws2 = new WorkStation(wipLimit);
            WorkStation ws3 = new WorkStation(wipLimit);

            process.Add(ws1);
            process.Add(ws2);
            process.Add(ws3);

            IProbabilityDistribution distribution1 = new DeterministicDistribution(0);
            IProbabilityDistribution distribution2 = new DeterministicDistribution(1);
            IProbabilityDistribution distribution3 = new DeterministicDistribution(1);
            IProbabilityDistribution distribution4 = new DeterministicDistribution(1);

            ResourcePool pool = new ResourcePool(2);

            ws1.AddMachine(new Machine(distribution1, pool));
            ws1.AddMachine(new Machine(distribution1, pool));
            ws1.AddMachine(new Machine(distribution1, pool));
            ws1.AddMachine(new Machine(distribution1, pool));
            ws1.AddMachine(new Machine(distribution1, pool));

            ws2.AddMachine(new Machine(distribution2, pool));
            ws2.AddMachine(new Machine(distribution2, pool));
            ws2.AddMachine(new Machine(distribution2, pool));
            ws2.AddMachine(new Machine(distribution3, pool));
            ws2.AddMachine(new Machine(distribution3, pool));

            ws3.AddMachine(new Machine(distribution4, pool));
            ws3.AddMachine(new Machine(distribution4, pool));
            ws3.AddMachine(new Machine(distribution4, pool));
            ws3.AddMachine(new Machine(distribution4, pool));
            ws3.AddMachine(new Machine(distribution4, pool));

            FlowTestHelper.TickAndAssert(process, 2, 0, 0, 0, 0, 0, 0);
            FlowTestHelper.TickAndAssert(process, 0, 0, 2, 0, 0, 0, 0);
            FlowTestHelper.TickAndAssert(process, 0, 0, 0, 0, 2, 0, 0);
            FlowTestHelper.TickAndAssert(process, 2, 0, 0, 0, 0, 0, 2);
            FlowTestHelper.TickAndAssert(process, 0, 0, 2, 0, 0, 0, 2);
            FlowTestHelper.TickAndAssert(process, 0, 0, 0, 0, 2, 0, 2);
            FlowTestHelper.TickAndAssert(process, 2, 0, 0, 0, 0, 0, 4);
        }
        public void ShouldForConwipRunPooledMachines()
        {
            WorkProcess process = new WorkProcess(new InfiniteBacklog());

            WipTokenPool wipLimit = new WipTokenPool(8);

            WorkStation ws1 = new WorkStation(wipLimit);
            WorkStation ws2 = new WorkStation(wipLimit);

            process.Add(ws1);
            process.Add(ws2);

            IProbabilityDistribution distribution1 = new DeterministicDistribution(4);
            IProbabilityDistribution distribution2 = new DeterministicDistribution(4);

            ResourcePool pool = new ResourcePool(3);

            ws1.AddMachine(new Machine(distribution1, pool));
            ws1.AddMachine(new Machine(distribution1, pool));
            ws1.AddMachine(new Machine(distribution1, pool));

            ws2.AddMachine(new Machine(distribution2, pool));
            ws2.AddMachine(new Machine(distribution2, pool));
            ws2.AddMachine(new Machine(distribution2, pool));

            FlowTestHelper.TickAndAssert(process, 3, 0, 0, 0, 0);
            FlowTestHelper.TickAndAssert(process, 3, 0, 0, 0, 0);
            FlowTestHelper.TickAndAssert(process, 3, 0, 0, 0, 0);
            FlowTestHelper.TickAndAssert(process, 3, 0, 0, 0, 0);
            FlowTestHelper.TickAndAssert(process, 0, 0, 3, 0, 0);
            FlowTestHelper.TickAndAssert(process, 0, 0, 3, 0, 0);
            FlowTestHelper.TickAndAssert(process, 0, 0, 3, 0, 0);
            FlowTestHelper.TickAndAssert(process, 0, 0, 3, 0, 0);
            FlowTestHelper.TickAndAssert(process, 3, 0, 0, 0, 3);
        }