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