public void Setup() { /// ARRANGE // ask system test setup class to get the context instance _context = SingletonTestSetup.Instance().Get(); }
public async Task Setup() { _context = SingletonTestSetup.Instance().Get(); route = await _context.Routes.Where(r => r.RouteId == "VR-140").FirstOrDefaultAsync(); pilot = new Pilot { Aircraft = "F-16", EmailId = "*****@*****.**", Name = "Test Pilot", Pwd = "a" }; await _context.Pilots.AddAsync(pilot); _context.Entry(pilot).State = EntityState.Added; await _context.SaveChangesAsync(); }
public async Task Setup() { /// ARRANGE // ask system test setup class to get the context instance _context = SingletonTestSetup.Instance().Get(); //Wait route = new Route() { RouteId = "IR-140" }; await AddRoute(route); repo = new RouteRepo(_context); }
public async Task Setup() { /// ARANGE /// // ask system test setup class to get the context instance _context = SingletonTestSetup.Instance().Get(); // make the test routes and points route1 = new Route() { RouteId = "R-1" }; route2 = new Route() { RouteId = "R-2" }; point1 = new Point() { Latitude = 1.0f, Longitude = 1.0f }; point2 = new Point() { Latitude = 2.0f, Longitude = 2.0f }; // insert the data so we can make RoutePoints await AddRoute(route1); await AddRoute(route2); await AddPoint(point1); await AddPoint(point2); // make the rp's with different points and same route var queryPoints = await _context.Points.ToListAsync(); foreach (Point p in queryPoints) { var rp = new RoutePoint { Point = p, Route = route1, PointId = p.PointId, RouteId = route1.RouteId }; await AddRoutePoint(rp); } // make rp's with same different routes and same point var queryRoutes = await _context.Routes.ToListAsync(); foreach (Route r in queryRoutes) { try // avoids trying to insert duplicates { var rp = new RoutePoint { Point = queryPoints[0], Route = r, PointId = queryPoints[0].PointId, RouteId = r.RouteId }; await AddRoutePoint(rp); } catch (DbUpdateException ex) { Console.WriteLine(ex.ToString()); } catch (InvalidOperationException ex) { Console.WriteLine(ex.ToString()); } } repo = new RoutePointRepo(_context); }