public void Add_NewDrink_DrinkAddedAndSaved() { // Arrange var added = false; var saved = false; var drink = new DrinkDTO { Name = "Fanta", Quantity = 3 }; _drinkRepositoryMock.Setup(s => s.Insert(It.IsAny <Drink>())).Callback(() => added = true); _drinkRepositoryMock.Setup(s => s.Save()).Callback(() => saved = true); _drinkRepositoryMock.Setup(s => s.Get(It.IsAny <Expression <Func <Drink, bool> > >(), It.IsAny <Func <IQueryable <Drink>, IOrderedQueryable <Drink> > >())).Returns(new List <Drink>()); // Act _drinkService.AddDrink(drink); // Assert Assert.IsTrue(added); Assert.IsTrue(saved); }
public IHttpActionResult Add(DrinkDTO drink) { _drinkService.AddDrink(drink); return(Ok()); }
public string SaveDrink(Drink drink) { return(drinkService.AddDrink(drink)); }
public void AddDrinkToMachine(int machineId, int drinkId, int count) { _drinkService.AddDrink(machineId, drinkId, count); }