Exemple #1
0
        public void Should_create_connection_for_provider_name()
        {
            string providerName = "System.Data.SqlClient";

            IDbConnection mockConnection = _mockery.DynamicMock <IDbConnection>( );

            using (_mockery.Record( )) {
                SetupResult.For(_mockConfiguration.ProviderName( )).Return(providerName);

                Expect.Call(_mockProviderFactory.CreateConnectionFor(providerName)).Return(mockConnection);
            }

            using (_mockery.Playback( )) {
                CreateSUT( ).CreateCommandFor("");
            }
        }
Exemple #2
0
 public DatabaseConnection(IDatabaseConfiguration configuration, IDatabaseProviderFactory providerFactory)
 {
     _connection = providerFactory.CreateConnectionFor(configuration.ProviderName( ));
     _connection.ConnectionString = configuration.ConnectionString( );
     _connection.Open( );
 }