public void ToEnumerable_without_arguments_generates_an_enumerable_without_connection_ownership() { var provider = Substitute.For <IMappingProvider>(); provider.Get <Tentity>().Returns(new TentityMapper()); EntityMappingProvider.Provider = provider; var connection = new FakeConnection() { CurrentState = ConnectionState.Open }; var cmd = new FakeCommand(connection, new CommandResult[] { new ReaderCommandResult() { Result = new FakeDataReader(new DataTable()) }, }); cmd.CommandText = "Hello"; var actual = cmd.ToEnumerable <Tentity>(); actual.GetEnumerator().Dispose(); connection.State.Should().Be(ConnectionState.Open); }