public void CreateCommand()
        {
            var factory = Substitute.For<IConnectionFactory>();
            var connectionMock = Substitute.For<IDbConnection>();
            var expected = Substitute.For<IDbCommand>();
            connectionMock.CreateCommand().Returns(expected);
            factory.Create().Returns(connectionMock);

            var context = new AdoNetContext(factory);
            var command = context.CreateCommand();

            Assert.NotNull(command);
            Assert.Same(expected, command);
        }
        public void CommandWithoutTransaction()
        {
            var factory = Substitute.For<IConnectionFactory>();
            var connectionMock = Substitute.For<IDbConnection>();
            var command = Substitute.For<IDbCommand>();
            connectionMock.CreateCommand().Returns(command);
            var transaction = Substitute.For<IDbTransaction>();
            connectionMock.BeginTransaction().Returns(transaction);
            factory.Create().Returns(connectionMock);

            var context = new AdoNetContext(factory);
            context.CreateUnitOfWork().Dispose();
            var cmd = context.CreateCommand();

            Assert.NotSame(transaction, cmd.Transaction);
        }