public JsonResult DrinkActions(string drink) { List <String> actions = null; switch (drink.ToLower()) { case "coffee": var coffee = new Coffee(); actions = coffee.Actions(); break; case "lemontea": var tea = new LemonTea(); actions = tea.Actions(); break; case "chocolate": var chocolate = new Chocolate(); actions = chocolate.Actions(); break; default: // empty list actions = new List <String>(); break; } return(new JsonResult(actions)); }
public void TestChocolate() { var sut = new Chocolate(); var actions = sut.Actions(); Assert.AreEqual(actions.Count, 3); Assert.AreEqual(0, actions.FindIndex(a => a.Contains("Boil some water"))); Assert.AreEqual(1, actions.FindIndex(a => a.Contains("Add drinking chocolate to the water"))); Assert.AreEqual(2, actions.FindIndex(a => a.Contains("Pour chocolate in the cup"))); }