public void GetAllStatuses_ReturnsResults() { DatabaseBootstrapper.CreateAndPopulate(); DataTable dataTable = QueryRunner.ExecuteStoredProcedure("uspGetAllStatuses"); DatabaseBootstrapper.Drop(); Assert.True(dataTable.Rows.Count > 0); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { DatabaseBootstrapper.Register(services); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new Info { Title = "My API", Version = "v1" }); }); }
public static void Main(string[] args) { if (args.Any(arg => arg == "bootstrapdb")) { var bootstrapper = new DatabaseBootstrapper(); bootstrapper.Run(); Console.WriteLine("Database bootstrapping complete..."); } else { BuildWebHost(args).Run(); } }
public void GetAllStatuses_ReturnsResults_ThrowsOnExtraProperty() { DatabaseBootstrapper.CreateAndPopulate(); DataTable dataTable = QueryRunner.ExecuteStoredProcedure("uspGetAllStatuses"); DatabaseBootstrapper.Drop(); DataTableConverter dtp = new DataTableConverter(); dtp.DataTableParserSettings.MissingMappingHandling = MissingMappingHandling.Error; Assert.Throws <MissingMappingException <StatusExtraProperty> >(() => dtp.ConvertToObjectList <StatusExtraProperty>(dataTable)); }
public void GetAllStatuses_ReturnsResults_CanBeParsedWithMissingFields() { DatabaseBootstrapper.CreateAndPopulate(); DataTable dataTable = QueryRunner.ExecuteStoredProcedure("uspGetAllStatuses"); DatabaseBootstrapper.Drop(); DataTableConverter dtp = new DataTableConverter(); var results = dtp.ConvertToObjectList <StatusPropertyNameMissing>(dataTable); Assert.Equal(dataTable.Rows.Count, results.Count()); }
public void GetAllStatuses_ReturnsResults_IgnoresExtraProperty() { DatabaseBootstrapper.CreateAndPopulate(); DataTable dataTable = QueryRunner.ExecuteStoredProcedure("uspGetAllStatuses"); DatabaseBootstrapper.Drop(); DataTableConverter dtp = new DataTableConverter(); dtp.DataTableParserSettings.MissingMappingHandling = MissingMappingHandling.Ignore; var results = dtp.ConvertToObjectList <StatusExtraProperty>(dataTable); Assert.Equal(dataTable.Rows.Count, results.Count()); }
public void GetAllStatuses_ReturnsResults_CanBeParsedWithCorrectObjects() { DatabaseBootstrapper.CreateAndPopulate(); DataTable dataTable = QueryRunner.ExecuteStoredProcedure("uspGetAllStatuses"); DatabaseBootstrapper.Drop(); DataTableConverter dtp = new DataTableConverter(); var results = dtp.ConvertToObjectList <StatusPropertyNamesMatch>(dataTable); Assert.True(results.Where(r => r.Id == (int)dataTable.Rows[0]["Id"] && r.Description == dataTable.Rows[0]["Description"].ToString() && r.IsPublic == (bool)dataTable.Rows[0]["IsPublic"]).Count() == 1); }
public static void ApplicationStart() { DatabaseBootstrapper.Bootstrap(); MvcHandler.DisableMvcResponseHeader = true; //AreaRegistration.RegisterAllAreas(); RegisterGlobalFilters(GlobalFilters.Filters); RegisterRoutes(RouteTable.Routes); RegisterBundles(BundleTable.Bundles); ViewEngines.Engines.Clear(); var engine = new ViewModelSpecifiedViewEngine(); ViewEngines.Engines.Insert(0, engine); VirtualPathFactoryManager.RegisterVirtualPathFactory(engine); SetupMiniProfiler(); }
public static void Main(string[] args) { log4net.Config.XmlConfigurator.Configure(); Log("Starting Up..."); azureStorageAccountName = ConfigurationManager.AppSettings["azure-storage-account-name"]; azureStorageAccountKey = ConfigurationManager.AppSettings["azure-storage-account-key"]; azureStorageBaseURL = "https://" + azureStorageAccountName + ".blob.core.windows.net/" + ConfigurationManager.AppSettings["azure-storage-blob-container"] + "/"; var connectionString = ConfigurationManager.AppSettings["db_fodt"]; var cfg = DatabaseBootstrapper.Bootstrap(connectionString); sessionFactory = cfg.BuildSessionFactory(); Log("Opening Connection to Old FODT DB"); oldDatabaseConnection = new MySql.Data.MySqlClient.MySqlConnection(ConfigurationManager.AppSettings["db_old_fodt"]); oldDatabaseConnection.Open(); if (doDatabaseImport) { TruncateDatabase(); ImportPhotos(); ImportAwardsList(); ImportPersons(); ImportPersonPhotos(); ImportShows(); ImportShowPhotos(); ImportAwards(); ImportCast(); ImportCrew(); ImportEC(); FixInsertedDateTimeColumns(); } if (doFixLargePhotoFlag) { FixLargePhotoFlag(); } if (doBlobUpload) { ImportPhotoBlobs(); } }