public void should_throw_if_BeginScope_called_after_Dispose() { var mock = Mocks.New(); var context = new DapperContext(mock.Connection); context.Dispose(); Assert.Throws<ObjectDisposedException>(() => context.Begin()); }
public void should_throw_if_BeginScope_called_after_Dispose() { var mock = Mocks.New(); var context = new DapperContext(mock.Connection); context.Dispose(); Assert.Throws <ObjectDisposedException>(() => context.Begin()); }
public void should_open_connection_for_BeingScope() { var mock = Mocks.New(); var context = new DapperContext(mock.Connection); mock.Connection.State.Returns(ConnectionState.Closed); //close the connection to test since it will open in the constructor mock.Connection.ClearReceivedCalls(); context.Begin(); mock.Connection.Received(1).Open(); }
public void should_commit_transaction() { var mock = Mocks.New(); var context = new DapperContext(mock.Connection); context.Begin(); using (context) { context.Commit(); mock.Transaction.Received(1).Commit(); } }