Exemplo n.º 1
0
        public DatabaseAndWebserviceFixture()
        {
            var builder = new ConfigurationBuilder()
                          .SetBasePath(Directory.GetCurrentDirectory())
                          .AddJsonFile("appsettings.json");

            Configuration = builder.Build();

            Context    = new ElectionDbContext(Configuration.GetConnectionString("FpElectionDatabase"));
            Webservice = new WebserviceRawCommunication();

            // Try to create database (if not exists) and populate with candidates data
            var dbInitializer = new DatabaseInitializer(Context, new GetJsonCandidateListFromWsService(Webservice));

            dbInitializer.DeleteTablesInDatabase();
            dbInitializer.InitializeDbWithCandidatesAndParties();
        }