public async void GetDeleteNegativeId() { using (var database = new TestDb()) { var controller = new IndividualsController(database.Context); IActionResult result = await controller.Delete(-1); CheckMessage(result, $"The Individual ID must be between 1 and {int.MaxValue}."); } }
public async void GetDeleteNotFound() { using (var database = new TestDb()) { var controller = new IndividualsController(database.Context); IActionResult result = await controller.Delete(50); CheckMessage(result, "The selected Individual could not be found."); } }
public async void GetDeleteNullId() { using (var database = new TestDb()) { var controller = new IndividualsController(database.Context); IActionResult result = await controller.Delete(null); CheckMessage(result, "The Individual ID provided was invalid."); } }
public async void GetDeleteFound() { using (var database = new TestDb()) { var controller = new IndividualsController(database.Context); IActionResult result = await controller.Delete(10); IndividualViewModel viewModel = CheckViewModel(result); Individual individual = database.Context.Individuals.SingleOrDefault(i => i.Id == 10); Assert.Equal(10, viewModel.Individual.Id); Assert.Equal(individual.Name, viewModel.Individual.Name); Assert.Equal(individual.BreedId, viewModel.Individual.Breed.Id); } }