public void VerifyHospitalOneOrder()
        {
            HospitalState state = new HospitalState();
            state.AddItem(new InventoryLevel("DOSE0001", "AcuDose", "Acetaminophen", 2, 20, 4, 6));
            state.AddItem(new InventoryLevel("MEDCAR01", "MedCarousel", "Bismuth Subsalicylate", 4, 40, 10, 10));

            OrderCreator creator = new OrderCreator();

            HospitalOrder order = creator.CreateOrder(state);

            Assert.Contains(new HospitalOrderItem("DOSE0001", "Acetaminophen", 3), order.Items);
            Assert.Contains(new HospitalOrderItem("MEDCAR01", "Bismuth Subsalicylate", 4), order.Items);
        }
예제 #2
0
        public HospitalOrder CreateOrder(HospitalState state)
        {
            HospitalOrder order = new HospitalOrder();

            foreach (var inventoryLevel in state.InventoryLevels)
            {
                IDetermineNeed needStrategy = NeedStrategyFactory.GetStrategy(inventoryLevel.DeviceType);
                int packagesNeeded = needStrategy.DetermineNeed(inventoryLevel);
                if (packagesNeeded > 0)
                {
                    order.AddItem(
                        new HospitalOrderItem(inventoryLevel.Device, inventoryLevel.Medication, packagesNeeded));
                }
            }

            return order;
        }