public void AddProductToCoffeeMachine() { CoffeeMachine coffeeMachine = new CoffeeMachine(); Product product = new Product("Coffee"); coffeeMachine.AddProduct(product); Assert.AreEqual(coffeeMachine.GetProductById(product.ProductId), product, "Products must be equal"); }
public int PostCoffeeMachine(CoffeeMachineViewModel coffeeMachineViewModel) { CoffeeMachine coffeeMachine = null; if (coffeeMachineViewModel != null) { coffeeMachine = new CoffeeMachine(); List<Product>products = coffeeMachineViewModel.Products; foreach(Product product in products) { coffeeMachine.AddProduct(product); } } coffeeMachine.coffeeMachineId = 1; if (coffeeMachine != null) return coffeeMachine.getCoffeeMachineId(); else { return 0; } }