public async void FailDelete() { // Arrange var options = new DbContextOptionsBuilder <AlpmysContext>() .UseInMemoryDatabase("FailDeleteEvent") .Options; AlpmysContext context = new AlpmysContext(options); EventosController controller = new EventosController(context); Evento e = new Evento(); e.Nome = "Evento!"; // Act await controller.PostEvento(e); var result = await controller.DeleteEvento(10); // Assert Assert.IsType <NotFoundResult>(result); }
public async void Delete() { // Arrange var options = new DbContextOptionsBuilder <AlpmysContext>() .UseInMemoryDatabase("DeleteEvent") .Options; AlpmysContext context = new AlpmysContext(options); EventosController controller = new EventosController(context); Evento e = new Evento(); e.Id = 9; e.Nome = "Evento!"; // Act await controller.PostEvento(e); await controller.DeleteEvento(9); // Assert Assert.Equal(0, context.Evento.Count()); }