public async void Car_GetAll() { //https://asp.net-hacker.rocks/2017/09/27/testing-aspnetcore.html CarRepository carRepository = new CarRepository(); var controller = new CarWebApi.Controllers.CarController(carRepository); var result = await controller.GetAllCars(); }
public async void Car_Delete_Last() { //https://asp.net-hacker.rocks/2017/09/27/testing-aspnetcore.html CarRepository carRepository = new CarRepository(); var controller = new CarWebApi.Controllers.CarController(carRepository); List<Car> cars = await controller.GetAllCars() as List<Car>; Assert.NotEmpty(cars); int id = (from c in cars //where c.Id > 100000 select c).Max(c => c.Id); var result = await controller.Delete(id); await carRepository.SaveAll(); }