private GetExactly ( DbPlatform dbPlatform ) : |
||
dbPlatform | DbPlatform | |
return |
public void CheckProviderValidation(DbPlatform platformUnderExecution, DbAltererOptions options, int expectedTotalNumberOfSupportedProviders, int expectedValidationRuns) { // arrange var providerLocator = new ProviderLocator(new ProviderFactory()); int totalNumberOfSupportedProviders = options.SupportedPlatforms.Sum(n => providerLocator.GetAllForMinimumRequirement(n).Count()); var validatorFactory = new ValidatorFactory(providerLocator.GetExactly(platformUnderExecution), options, providerLocator); Validator validator = validatorFactory.Create(); var reporter = A.Fake<IMigrationReporter>(); string errors; string warnings; // act validator.Validate(new[] { reporter }, out errors, out warnings); // assert Assert.AreEqual(expectedTotalNumberOfSupportedProviders, totalNumberOfSupportedProviders, "Wrong total number of providers."); A.CallTo(() => reporter.Report(A<IMigrationContext>._)).MustHaveHappened(Repeated.Exactly.Times(expectedValidationRuns)); }
public SqlAggregateMigrationGenerator(Server server, Database database, GeneratorOptions options) : base(server, database, options) { var providerLocator = new ProviderLocator(new ProviderFactory()); // CLEAN: use DI container ProviderInfo provider = providerLocator.GetExactly(DbPlatform.SqlServer2008); var versioningTableName = new TableName(options.VersioningTableName, options.VersioningTableSchema); _history = new History(versioningTableName, provider.Metadata); IDbConnection connection = server.ConnectionContext.SqlConnectionObject; connection.Open(); connection.ChangeDatabase(Database.Name); // ATTENTION: possibly has side-effects try { _history.Load(connection, null); } finally { connection.Close(); } }
public virtual void Setup() { _options = new MigrationOptions(); _options.SupportedPlatforms.Set(new[] { DbPlatform }); // avoid validation errors/warnings from other providers // initialize IntegrationTestContext IProviderFactory providerFactory = new ProviderFactory(); var providerLocator = new ProviderLocator(providerFactory); ProviderInfo providerInfo = providerLocator.GetExactly(DbPlatform); IntegrationTestContext.Initialize(_options, providerInfo); }
public void TestGetExactlyThrowsIfNoMatchingProviderIsFound() { var locator = new ProviderLocator(new ProviderFactory()); ProviderInfo info = locator.GetExactly(DbPlatform.SqlServer2014); Assert.AreEqual("SqlServer2014Provider", info.Provider.GetType().FullName); }
public void TestGetExactly() { var locator = new ProviderLocator(new ProviderFactory()); ProviderInfo info = locator.GetExactly(DbPlatform.SqlServer2008); Assert.AreEqual("SqlServer2008Provider", info.Provider.GetType().Name); }