public async Task Setup()
        {
            var create = new CreateDatabase(new DatabaseConnection());

            if (!await create.IsCreated())
            {
                await create.Create();
            }

            var populate = new PopulateTables(new DatabaseConnection());

            // as we've modified the SubmissionsEvents table, we need to enable the
            // seamless upgrade of the table on the first run after fetching the new code.
            // previously, the tests didn't populate the table, so we check for that.
            // this way we handle (a) first run with empty database,
            // (b) first run after table modification & (c) subsequent runs
            if (!await create.IsSubmissionEventsCreated() ||
                !await populate.IsSubmissionEventsTablePopulated())
            {
                await create.CreateSubmissionEvents();
            }

            var setup = new DatabaseSetup(populate);
            await setup.PopulateTestData().ConfigureAwait(false);
        }
示例#2
0
    public void fillAirplaneData(int id, string modelName, string waypoints)
    {
        populateCoordinates = new PopulateTables();

        clearAllFields();
        populateAllFields(id, modelName, waypoints);
    }
 public async Task PopulateTestData()
 {
     if (await PopulateTables.IsSubmissionEventsTablePopulated())
     {
         await ReadSubmissionEvents();
         await ReadSubmissionEventsForUlnCheck();
     }
     else
     {
         await PopulateSubmissionEvents();
     }
 }
 private async Task PopulateEventsForByUln(long uln, int count)
 {
     TestData.SubmissionEventsForUln = new Fixture().CreateMany <ItSubmissionEvent>(count).ToList();
     foreach (var @event in TestData.SubmissionEventsForUln)
     {
         @event.Uln = uln;
         // these fields are just date's in the db
         @event.ActualStartDate = @event.ActualStartDate.Value.Date;
         @event.ActualEndDate   = @event.ActualEndDate.Value.Date;
         @event.PlannedEndDate  = @event.PlannedEndDate.Value.Date;
         // these fields are datetime's in the db, so can't match the precision of c#'s datetime, so we chop off the milliseconds
         @event.SubmittedDateTime =
             @event.SubmittedDateTime.AddTicks(-(@event.SubmittedDateTime.Ticks % TimeSpan.TicksPerSecond));
         @event.FileDateTime = @event.FileDateTime.AddTicks(-(@event.FileDateTime.Ticks % TimeSpan.TicksPerSecond));
     }
     await PopulateTables.BulkInsertSubmissionEvents(TestData.SubmissionEventsForUln);
 }
    public void populateAirplanes(ArrayList airplanesData)
    {
        populationAirplanes = new PopulateTables();

        AirplaneTrajectoriesView atvScript = trajectories.GetComponent <AirplaneTrajectoriesView> ();

        atvScript.clean();

        foreach (AirplaneModel data in airplanesData)
        {
            ArrayList rowData = new ArrayList();
            rowData.Add(data.id.ToString());
            rowData.Add(data.name);
            rowData.Add(data.waypoints);

            populationAirplanes.addRowToTable(tableAirplanes, airplaneRowView, rowData);

            atvScript.drawAirplane(data.id, data.waypoints);
        }
    }
        private async Task PopulateSubmissionEvents()
        {
            Debug.WriteLine("Populating submission events table, this could take a while");

            await PopulateEventsForByUln(1002105691, 2);
            await PopulateEventsForByUln(1002105888, 1);

            TestData.SubmissionEvents = new Fixture().CreateMany <ItSubmissionEvent>(10).ToList();
            foreach (var @event in TestData.SubmissionEvents)
            {
                @event.Uln = 0;
                // these fields are just date's in the db
                @event.ActualStartDate = @event.ActualStartDate.Value.Date;
                @event.ActualEndDate   = @event.ActualEndDate.Value.Date;
                @event.PlannedEndDate  = @event.PlannedEndDate.Value.Date;
                // these fields are datetime's in the db, so can't match the precision of c#'s datetime, so we chop off the milliseconds
                @event.SubmittedDateTime = @event.SubmittedDateTime.AddTicks(-(@event.SubmittedDateTime.Ticks % TimeSpan.TicksPerSecond));
                @event.FileDateTime      = @event.FileDateTime.AddTicks(-(@event.FileDateTime.Ticks % TimeSpan.TicksPerSecond));
            }
            await PopulateTables.BulkInsertSubmissionEvents(TestData.SubmissionEvents);
        }
示例#7
0
 void Start()
 {
     childCount          = tableWaypoints.transform.childCount;
     populateCoordinates = new PopulateTables();
 }
 public DatabaseSetup(PopulateTables populate)
 {
     _populate = populate;
 }