public async void GetDetailsNotFound() { using (var database = new TestDb()) { var controller = new IndividualsController(database.Context); IActionResult result = await controller.Details(50); CheckMessage(result, "The selected Individual could not be found."); } }
public async void GetDetailsNullId() { using (var database = new TestDb()) { var controller = new IndividualsController(database.Context); IActionResult result = await controller.Details(null); CheckMessage(result, "The Individual ID provided was invalid."); } }
public async void GetDetailsNegativeId() { using (var database = new TestDb()) { var controller = new IndividualsController(database.Context); IActionResult result = await controller.Details(-1); CheckMessage(result, $"The Individual ID must be between 1 and {int.MaxValue}."); } }
public async void GetDetailsFound() { using (var database = new TestDb()) { var controller = new IndividualsController(database.Context); IActionResult result = await controller.Details(5); IndividualViewModel viewModel = CheckViewModel(result); Individual individual = database.Context.Individuals.SingleOrDefault(i => i.Id == 5); Assert.Equal(5, viewModel.Individual.Id); Assert.Equal(individual.Name, viewModel.Individual.Name); Assert.NotEmpty(viewModel.Breeds); } }