public void DataAccessSetUp() { #if (NETCOREAPP2_1) DbProviderFactories.RegisterFactory("System.Data.SqlClient", SqlClientFactory.Instance); #endif TransactionScopeFactory = new DefaultTransactionScopeFactory(true, IsolationLevel.ReadCommitted, TimeSpan.FromSeconds(120)); DatabaseGateway = new DatabaseGateway(); DataRowMapper = new DataRowMapper(); DatabaseContextCache = new ThreadStaticDatabaseContextCache(); var connectionConfigurationProvider = new Mock <IConnectionConfigurationProvider>(); connectionConfigurationProvider.Setup(m => m.Get(It.IsAny <string>())).Returns( new ConnectionConfiguration( "Abacus", "System.Data.SqlClient", "Data Source=.\\sqlexpress;Initial Catalog=Abacus;Integrated Security=SSPI;")); DatabaseContextFactory = new DatabaseContextFactory( connectionConfigurationProvider.Object, new DbConnectionFactory(), new DbCommandFactory(), new ThreadStaticDatabaseContextCache()); DatabaseContextFactory.ConfigureWith("Abacus"); QueryMapper = new QueryMapper(DatabaseGateway, DataRowMapper); }
public void TestSetUp() { DbProviderFactories.RegisterFactory("System.Data.SqlClient", SqlClientFactory.Instance); DatabaseGateway = new DatabaseGateway(); DatabaseContextCache = new ThreadStaticDatabaseContextCache(); var connectionConfigurationProvider = new Mock <IConnectionConfigurationProvider>(); connectionConfigurationProvider.Setup(m => m.Get(It.IsAny <string>())).Returns( (string name) => new ConnectionConfiguration( name, "System.Data.SqlClient", name.Equals(EventStoreProjectionConnectionStringName) ? "server=.;Initial Catalog=ShuttleProjection;user id=sa;password=Pass!000" : "server=.;Initial Catalog=Shuttle;user id=sa;password=Pass!000")); ConnectionConfigurationProvider = connectionConfigurationProvider.Object; DatabaseContextFactory = new DatabaseContextFactory( ConnectionConfigurationProvider, new DbConnectionFactory(), new DbCommandFactory(), new ThreadStaticDatabaseContextCache()); ClearDataStore(); }
public void DataAccessSetUp() { DbProviderFactories.RegisterFactory("System.Data.SqlClient", SqlClientFactory.Instance); TransactionScopeFactory = new DefaultTransactionScopeFactory(true, IsolationLevel.ReadCommitted, TimeSpan.FromSeconds(120)); DatabaseGateway = new DatabaseGateway(); DatabaseContextCache = new ThreadStaticDatabaseContextCache(); DatabaseContextFactory = new DatabaseContextFactory(new ConnectionConfigurationProvider(), new DbConnectionFactory(), new DbCommandFactory(), DatabaseContextCache); DatabaseContextFactory.ConfigureWith("DocumentStore"); QueryMapper = new QueryMapper(DatabaseGateway, new DataRowMapper()); }
public void TestSetUp() { DatabaseGateway = new DatabaseGateway(); DatabaseContextCache = new ThreadStaticDatabaseContextCache(); #if (!NETCOREAPP2_1 && !NETSTANDARD2_0) DatabaseContextFactory = new DatabaseContextFactory( new ConnectionConfigurationProvider(), new DbConnectionFactory(), new DbCommandFactory(), new ThreadStaticDatabaseContextCache()); #else DbProviderFactories.RegisterFactory("System.Data.SqlClient", System.Data.SqlClient.SqlClientFactory.Instance); var mockConnectionConfigurationProvider = new Mock <IConnectionConfigurationProvider>(); mockConnectionConfigurationProvider.Setup(m => m.Get(It.IsAny <string>())).Returns( (string name) => name.Equals("EventStoreProjection") ? new ConnectionConfiguration( "EventStoreProjection", "System.Data.SqlClient", "Data Source=.\\sqlexpress;Initial Catalog=ShuttleProjection;Integrated Security=SSPI;") : new ConnectionConfiguration( name, "System.Data.SqlClient", "Data Source=.\\sqlexpress;Initial Catalog=Shuttle;Integrated Security=SSPI;")); ConnectionConfigurationProvider = mockConnectionConfigurationProvider.Object; DatabaseContextFactory = new DatabaseContextFactory( ConnectionConfigurationProvider, new DbConnectionFactory(), new DbCommandFactory(), new ThreadStaticDatabaseContextCache()); #endif ClearDataStore(); }