public void close_connection_if_owned_is_set() { var connection = new Griffin.AdoNetFakes.FakeConnection(); connection.CurrentState = ConnectionState.Open; var sut = new AdoNetUnitOfWork(connection, true); sut.Dispose(); connection.State.Should().Be(ConnectionState.Closed); }
public void rollback_transaction_if_savechanges_have_not_been_made() { var connection = new Griffin.AdoNetFakes.FakeConnection(); connection.CurrentState = ConnectionState.Open; var sut = new AdoNetUnitOfWork(connection); sut.Dispose(); connection.Transactions[0].IsRolledBack.Should().BeTrue(); }
public void dont_close_connection_per_default() { var connection = new Griffin.AdoNetFakes.FakeConnection(); connection.CurrentState = ConnectionState.Open; var sut = new AdoNetUnitOfWork(connection); sut.Dispose(); connection.State.Should().Be(ConnectionState.Open); }
public void close_connection_on_dispose_even_if_savechanges_have_been_called() { var connection = new Griffin.AdoNetFakes.FakeConnection(); connection.CurrentState = ConnectionState.Open; var sut = new AdoNetUnitOfWork(connection, true); sut.SaveChanges(); sut.Dispose(); connection.Transactions[0].IsCommitted.Should().BeTrue(); connection.State.Should().Be(ConnectionState.Closed); }