public async void PostDeleteConfirmNegativeId() { using (var database = new TestDb()) { var controller = new IndividualsController(database.Context); IActionResult result = await controller.DeleteConfirmed(-1); RedirectToActionResult redirect = Assert.IsType <RedirectToActionResult>(result); Assert.Equal("Index", redirect.ActionName); } }
public async void PostDeleteConfirmSuccess() { using (var database = new TestDb()) { Assert.True(database.Context.Individuals.Any(i => i.Id == 3)); var controller = new IndividualsController(database.Context); IActionResult result = await controller.DeleteConfirmed(3); RedirectToActionResult redirect = Assert.IsType <RedirectToActionResult>(result); Assert.Equal("Index", redirect.ActionName); Assert.False(database.Context.Individuals.Any(i => i.Id == 3)); } }