public void AddIngredient_ToDatabase_AddsIngredientToDatabase() { var mockDataService = new Mock <IDataService>(); mockDataService.Setup(x => x.CreateIngredient(It.IsAny <Ingredient>())); var controller = new FoodController(mockDataService.Object); var vm = new IngredientViewModel { Name = "Chicken", Quantity = 250, Units = new List <SelectListItem> { new SelectListItem { Text = "g" } } }; vm.Units = new List <SelectListItem> { new SelectListItem { Text = "g" } }; var result = controller.AddIngredient(vm); mockDataService.Verify(x => x.CreateIngredient(It.IsAny <Ingredient>()), Times.Exactly(1)); }