Ejemplo n.º 1
0
        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);
        }