public WhenCallingCreateCommand_WithConnectionScopePerSession_AndThereIsNoTransaction() { this.mockDbDriver.Setup(x => x.CreateConnection()).Returns(this.mockConnection.Object); this.mockDbDriver.Setup(x => x.BuildCommand(sqlQuery)).Returns(this.mockCommand.Object); var sessionBase = new TestSessionBase(ConnectionScope.PerSession, this.mockDbDriver.Object); sessionBase.CallCreateCommand(sqlQuery); }
public WhenCallingConfigureCommand_WithConnectionScopePerTransaction_ThereIsNoTransaction_AndTheConnectionIsClosed() { this.mockConnection.Setup(x => x.State).Returns(ConnectionState.Closed); this.mockDbDriver.Setup(x => x.CreateConnection()).Returns(this.mockConnection.Object); this.mockConnection.Setup(x => x.CreateCommand()).Returns(this.mockCommand.Object); var sessionBase = new TestSessionBase(ConnectionScope.PerTransaction, this.mockDbDriver.Object); sessionBase.CallConfigureCommand(sqlQuery); }
public WhenCallingCommandCompleted_WithConnectionScopePerTransaction_ThereIsNoTransaction_AndTheConnectionIsOpen() { this.mockConnection.Setup(x => x.State).Returns(ConnectionState.Open); var mockDbDriver = new Mock <IDbDriver>(); mockDbDriver.Setup(x => x.CreateConnection()).Returns(mockConnection.Object); var sessionBase = new TestSessionBase(ConnectionScope.PerTransaction, mockDbDriver.Object); sessionBase.CallCommandCompleted(); }
public WhenCallingDispose_AndTheConnectionScopeIsPerTransaction() { this.mockConnection.Setup(x => x.CreateCommand()).Returns(this.mockCommand.Object); var mockDbDriver = new Mock <IDbDriver>(); mockDbDriver.Setup(x => x.CreateConnection()).Returns(this.mockConnection.Object); this.sessionBase = new TestSessionBase(ConnectionScope.PerTransaction, mockDbDriver.Object); this.sessionBase.CallConfigureCommand(new SqlQuery("")); this.sessionBase.Dispose(); }
public WhenCallingConfigureCommand_WithConnectionScopePerSession_AndThereIsATransaction() { this.mockConnection.Setup(x => x.BeginTransaction(It.IsAny <IsolationLevel>())).Returns(this.mockTransaction.Object); this.mockConnection.Setup(x => x.CreateCommand()).Returns(this.mockCommand.Object); this.mockDbDriver.Setup(x => x.CreateConnection()).Returns(this.mockConnection.Object); var sessionBase = new TestSessionBase(ConnectionScope.PerSession, this.mockDbDriver.Object); sessionBase.BeginTransaction(); sessionBase.CallConfigureCommand(sqlQuery); }
public WhenCallingCreateCommand_WithConnectionScopePerTransaction_ThereIsNoTransaction_AndTheConnectionIsClosed() { this.mockConnection.Setup(x => x.State).Returns(ConnectionState.Closed); this.mockDbDriver.Setup(x => x.GetConnection(ConnectionScope.PerTransaction)).Returns(this.mockConnection.Object); this.mockDbDriver.Setup(x => x.BuildCommand(sqlQuery)).Returns(this.mockCommand.Object); var sessionBase = new TestSessionBase(ConnectionScope.PerTransaction, this.mockDbDriver.Object); sessionBase.CallCreateCommand(sqlQuery); }
public WhenCallingCreateCommand_WithConnectionScopePerSession_AndThereIsATransaction() { this.mockConnection.Setup(x => x.BeginTransaction(It.IsAny<IsolationLevel>())).Returns(this.mockTransaction.Object); this.mockDbDriver.Setup(x => x.GetConnection(ConnectionScope.PerSession)).Returns(this.mockConnection.Object); this.mockDbDriver.Setup(x => x.BuildCommand(sqlQuery)).Returns(this.mockCommand.Object); var sessionBase = new TestSessionBase(ConnectionScope.PerSession, this.mockDbDriver.Object); sessionBase.BeginTransaction(); sessionBase.CallCreateCommand(sqlQuery); }
public WhenCallingCommandCompleted_WithConnectionScopePerTransaction_ThereIsNoTransaction_AndTheConnectionIsOpen() { this.mockConnection.Setup(x => x.State).Returns(ConnectionState.Open); var mockDbDriver = new Mock<IDbDriver>(); mockDbDriver.Setup(x => x.GetConnection(ConnectionScope.PerTransaction)).Returns(mockConnection.Object); var sessionBase = new TestSessionBase(ConnectionScope.PerTransaction, mockDbDriver.Object); sessionBase.CallCommandCompleted(); }
public WhenCallingDispose_AndTheConnectionScopeIsPerTransaction() { this.mockConnection.Setup(x => x.CreateCommand()).Returns(this.mockCommand.Object); var mockDbDriver = new Mock<IDbDriver>(); mockDbDriver.Setup(x => x.CreateConnection()).Returns(this.mockConnection.Object); this.sessionBase = new TestSessionBase(ConnectionScope.PerTransaction, mockDbDriver.Object); this.sessionBase.CallConfigureCommand(new SqlQuery("")); this.sessionBase.Dispose(); }
public WhenCallingConfigureCommand_WithConnectionScopePerTransaction_ThereIsATransaction_AndTheConnectionIsClosed() { this.mockConnection.Setup(x => x.State).Returns(ConnectionState.Closed); this.mockConnection.Setup(x => x.BeginTransaction(It.IsAny<IsolationLevel>())).Returns(this.mockTransaction.Object); this.mockConnection.Setup(x => x.CreateCommand()).Returns(this.mockCommand.Object); this.mockDbDriver.Setup(x => x.CreateConnection()).Returns(this.mockConnection.Object); var sessionBase = new TestSessionBase(ConnectionScope.PerTransaction, this.mockDbDriver.Object); sessionBase.BeginTransaction(); sessionBase.CallConfigureCommand(sqlQuery); }
public WhenCallingConfigureCommand_WithConnectionScopePerSession_AndThereIsNoTransaction() { this.mockDbDriver.Setup(x => x.CreateConnection()).Returns(this.mockConnection.Object); this.mockConnection.Setup(x => x.CreateCommand()).Returns(this.mockCommand.Object); var sessionBase = new TestSessionBase(ConnectionScope.PerSession, this.mockDbDriver.Object); sessionBase.CallConfigureCommand(sqlQuery); }