public async Task Put_returns_NoContent() { var dto = new WineDTO(); var repository = new Mock <IWineRepository>(); repository.Setup(s => s.UpdateAsync(dto)).ReturnsAsync(true); var controller = new WinesController(repository.Object); var put = await controller.Put(42, dto); Assert.IsType <NoContentResult>(put); }
public async Task Put_given_repository_returns_false_returns_NotFound() { var repository = new Mock <IWineRepository>(); var controller = new WinesController(repository.Object); var dto = new WineDTO(); var put = await controller.Put(42, dto); Assert.IsType <NotFoundResult>(put); }
public async Task Put_given_dto_updates_wine() { var repository = new Mock <IWineRepository>(); var controller = new WinesController(repository.Object); var dto = new WineDTO(); await controller.Put(42, dto); repository.Verify(s => s.UpdateAsync(dto)); }