public void SetUp()
 {
     _connectionProvider = new Mock<IDatabaseConnectionProvider>();
     _connection = new Mock<IDbConnection>();
     _connectionProvider.Setup(x => x.GetOpenConnection()).Returns(_connection.Object);
     _transactionWrapperMock = new Mock<ITransactionWrapper>();
     _databaseCommandInstaceProvider = new DatabaseCommandProvider(_connectionProvider.Object, _transactionWrapperMock.Object);
 }
Пример #2
0
 public IDatabaseSession CreateSession(string connectionString)
 {
     var sqlConnectionProvider = _connectionProvider ?? new SqlConnectionProvider(connectionString);
     var transactionWrapper = new TransactionWrapper(sqlConnectionProvider);
     var databaseConnectionManager = new DatabaseCommandProvider(sqlConnectionProvider, transactionWrapper);
     var databaseCommandCreator = new DatabaseCommandFactory(databaseConnectionManager);
     var databaseReaderFactory = new SqlDatabaseReaderFactory();
     var connectionHandler = new ConnectionHandler();
     return new DatabaseSession(databaseCommandCreator, transactionWrapper, databaseReaderFactory, connectionHandler);
 }