public CarsControllerIntegrationTests() { var connection = Effort.DbConnectionFactory.CreateTransient(); context = new WhereIsItContext(connection); CreateTestData(context); ICarsService carsService = new CarsService(context); this.carsController = new CarsController(carsService); }
private static void CreateTestData(WhereIsItContext context) { context.Cars.Add(new WhereIsIt.Entities.Car("Car1", "Owner1")); var car2 = new WhereIsIt.Entities.Car("Car2", "Owner2"); context.Cars.Add(car2); car2.Locations.Add(new WhereIsIt.Entities.Location { Address = "AddressCar2", Coordinates=new WhereIsIt.Entities.Coordinates() }); context.SaveChanges(); }