public ActionResult <Snack> Delete(int id) { try { return(Ok(_service.Delete(id))); } catch (Exception e) { return(BadRequest(e.Message)); } }
public void DELETE_ShouldReturnOneSnackLess() { //Arrange int x = 1; var options = new DbContextOptionsBuilder <CinemaDbContext>() .UseInMemoryDatabase(databaseName: "DELETE_ShouldReturnOneSnackLess") .Options; var context = new CinemaDbContext(options); SeedSnacks(context); var service = new SnackService(context); //Act var result = service.Delete(x); //Assert Assert.True(result); }