/// <summary> /// Update the Database Provider to use /// </summary> /// <param name="databaseProviderType">Database Provider Type</param> protected void UpdateDatabaseProvider(DatabaseProviderType databaseProviderType) { if (databaseProviderType == DatabaseProvider.DatabaseProviderType) { return; } switch (databaseProviderType) { case DatabaseProviderType.SqlServer: DatabaseProvider = new SqlServerDatabaseProvider(); break; case DatabaseProviderType.Postgres: DatabaseProvider = new PostgresDatabaseProvider(); break; case DatabaseProviderType.Firebird: DatabaseProvider = new FirebirdDatabaseProvider(); break; default: throw new StatementBuilderException($"Unsupported Database Provider provided [{databaseProviderType}]"); } DatabaseProviderChanged(); }
public void Constructor() { //---------------Set up test pack------------------- //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- var provider = new SqlServerDatabaseProvider(); //---------------Test Result ----------------------- Assert.IsNotNull(provider); }
public void Properties_ShouldReturnExpectedValue(string propertyName, object expectedValue) { //---------------Set up test pack------------------- var provider = new SqlServerDatabaseProvider(); //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- var propertyValue = provider.GetPropertyValue(propertyName); //---------------Test Result ----------------------- Assert.AreEqual(expectedValue, propertyValue); }
public void Properties_GivenDatabaseProvider_ShouldSetProperty() { //---------------Set up test pack------------------- var sqlProvider = new SqlServerDatabaseProvider(); //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- var selectColumn = new ColumnModel("testColumn") { DatabaseProvider = sqlProvider }; //---------------Test Result ----------------------- Assert.AreEqual(sqlProvider, selectColumn.DatabaseProvider); }
public void Properties_GivenDatabaseProvider_ShouldSetProperty() { //---------------Set up test pack------------------- var sqlProvider = new SqlServerDatabaseProvider(); //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- var tableModel = new TableModel("tableName") { DatabaseProvider = sqlProvider }; //---------------Test Result ----------------------- Assert.AreEqual(sqlProvider, tableModel.DatabaseProvider); }