public VendingMachine() { MachineBug = new BugModel(); TeaPort = new ProductPortModel() { ProductType = ProductTypeEnum.Tea }; CoffeePort = new ProductPortModel() { ProductType = ProductTypeEnum.Coffee }; CoffeeAndMilkPort = new ProductPortModel() { ProductType = ProductTypeEnum.CoffeeAndMilk }; JuicePort = new ProductPortModel() { ProductType = ProductTypeEnum.Juice }; }
public ProductPortModel GetPortForProduct(ProductTypeEnum productType) { var result = new ProductPortModel(); switch (productType) { case ProductTypeEnum.Tea: result = TeaPort; break; case ProductTypeEnum.Coffee: result = CoffeePort; break; case ProductTypeEnum.CoffeeAndMilk: result = CoffeeAndMilkPort; break; case ProductTypeEnum.Juice: result = JuicePort; break; } return(result); }