Example #1
0
 public void LazyInternalConnection_provider_name_calculated_when_connection_by_convention()
 {
     using (var connection = new LazyInternalConnection("ConnectionName"))
     {
         Assert.Equal("System.Data.SqlClient", connection.ProviderName);
     }
 }
Example #2
0
        public void Disposed_LazyInternalConnection_can_be_reused()
        {
            var internalConnection = new LazyInternalConnection("NameForFactory");

            try
            {
                var disposed1 = 0;
                var disposed2 = 0;

                var connection1 = internalConnection.Connection;
                connection1.Disposed += (_, __) => disposed1++;

                internalConnection.Dispose();
                Assert.Equal(1, disposed1);
                Assert.Equal(0, disposed2);

                var connection2 = internalConnection.Connection;
                connection2.Disposed += (_, __) => disposed2++;

                internalConnection.Dispose();
                Assert.Equal(1, disposed1);
                Assert.Equal(1, disposed2);
            }
            finally
            {
                internalConnection.Dispose();
            }
        }
        private void Can_replace_connection_implementation(
            ReplaceConnectionContext context,
            LazyInternalConnection newConnection)
        {
            Database.Delete(newConnection.Connection);
            Database.Delete(typeof(ReplaceConnectionContext).DatabaseName());

            context.InternalContext.OverrideConnection(newConnection);

            context.Entities.Add(
                new PersistEntity
                {
                    Name = "Testing"
                });
            context.SaveChanges();

            Assert.Same(newConnection.Connection, context.Database.Connection);
            Assert.True(Database.Exists(newConnection.Connection));
            Assert.False(Database.Exists(typeof(ReplaceConnectionContext).DatabaseName()));

            // By pass EF just to make sure everything targetted the correct database
            var cmd = newConnection.Connection.CreateCommand();
            cmd.CommandText = "SELECT Count(*) FROM PersistEntities";
            cmd.Connection.Open();
            Assert.Equal(1, cmd.ExecuteScalar());
            cmd.Connection.Close();
        }
Example #4
0
 public void LazyInternalConnection_provider_name_calculated_when_connection_from_config()
 {
     using (var connection = new LazyInternalConnection("name=LazyConnectionTest"))
     {
         Assert.Equal("System.Data.SqlServerCe.4.0", connection.ProviderName);
     }
 }
Example #5
0
 public void Default_connection_factory_is_used_to_create_connection_from_connection_string()
 {
     using (var internalConnection = new LazyInternalConnection("Database=HardCodedConnectionString"))
     {
         var connection = internalConnection.Connection;
         Assert.IsType <SqlConnection>(connection);
     }
 }
Example #6
0
 public void LazyInternalConnection_can_calculate_ConnectionHasModel_false_from_convention_without_initializing()
 {
     using (var connection = new LazyInternalConnection("MyName"))
     {
         Assert.False(connection.ConnectionHasModel);
         Assert.False(connection.IsInitialized);
     }
 }
Example #7
0
 public void LazyInternalConnection_can_calculate_ConnectionHasModel_true_from_config_file_without_initializing()
 {
     using (var connection = new LazyInternalConnection("name=EntityConnectionString"))
     {
         Assert.True(connection.ConnectionHasModel);
         Assert.False(connection.IsInitialized);
     }
 }
Example #8
0
 public void LazyInternalConnection_can_calculate_ConnectionHasModel_true_from_DbConnectionInfo_without_initializing()
 {
     using (var connection = new LazyInternalConnection(new DbConnectionInfo("EntityConnectionString")))
     {
         Assert.True(connection.ConnectionHasModel);
         Assert.False(connection.IsInitialized);
     }
 }
Example #9
0
 public void Nice_exception_is_thrown_if_connection_string_in_app_config_does_not_contain_provider_name()
 {
     using (var internalConnection = new LazyInternalConnection("ConnectionWithoutProviderName"))
     {
         Assert.Equal(
             Strings.DbContext_ProviderNameMissing("ConnectionWithoutProviderName"),
             Assert.Throws <InvalidOperationException>(() => { var _ = internalConnection.Connection; }).Message);
     }
 }
Example #10
0
 public void LazyInternalConnection_throws_when_cant_find_connection_from_DbConnectionInfo_in_config_file()
 {
     using (var connection = new LazyInternalConnection(new DbConnectionInfo("YouWontFindMe")))
     {
         Assert.Equal(
             Strings.DbConnectionInfo_ConnectionStringNotFound("YouWontFindMe"),
             Assert.Throws <InvalidOperationException>(() => { var temp = connection.Connection; }).Message);
     }
 }
Example #11
0
 public void LazyInternalConnection_ConnectionHasModel_without_initializing_throws_when_connection_not_in_config_DbConnectionInfo()
 {
     using (var connection = new LazyInternalConnection(new DbConnectionInfo("WontFindMe")))
     {
         Assert.Equal(
             Strings.DbConnectionInfo_ConnectionStringNotFound("WontFindMe"),
             Assert.Throws <InvalidOperationException>(() => { var temp = connection.ConnectionHasModel; }).Message);
     }
 }
Example #12
0
 public void LazyInternalConnection_can_calculate_ConnectionHasModel_false_from_DbConnectionInfo_without_initializing()
 {
     using (var connection = new LazyInternalConnection(new DbContext("LazyConnectionTest"),
                                                        new DbConnectionInfo("LazyConnectionTest")))
     {
         Assert.False(connection.ConnectionHasModel);
         Assert.False(connection.IsInitialized);
     }
 }
        public void Full_name_of_context_is_found_in_app_config()
        {
            using (var internalConnection = new LazyInternalConnection("Couger35.Hubcap.FullNameDbContext"))
            {
                var connection = internalConnection.Connection;

                Assert.Equal("FullNameInAppConfig", connection.Database);
                Assert.IsType<SqlConnection>(connection);
            }
        }
Example #14
0
        public void Connection_from_app_config_is_cached()
        {
            using (var internalConnection = new LazyInternalConnection("Couger35.Hubcap.FullNameDbContext"))
            {
                var connection = internalConnection.Connection;

                Assert.Same(connection, internalConnection.Connection);
                Assert.Same(connection, internalConnection.Connection);
            }
        }
Example #15
0
        public void Explicit_name_is_used_without_stripping_DbContext()
        {
            using (var internalConnection = new LazyInternalConnection("Couger35.Hubcap.NameForFactoryDbContext"))
            {
                var connection = internalConnection.Connection;

                Assert.Equal("Couger35.Hubcap.NameForFactoryDbContext", connection.Database);
                Assert.IsType <SqlConnection>(connection);
            }
        }
Example #16
0
 public void LazyInternalConnection_provider_name_calculated_when_connection_from_DbConnectionInfo()
 {
     using (
         var connection =
             new LazyInternalConnection(
                 new DbConnectionInfo("Data Source=ConnectionFromDbConnectionInfo.sdf", "System.Data.SqlServerCe.4.0")))
     {
         Assert.Equal("System.Data.SqlServerCe.4.0", connection.ProviderName);
     }
 }
Example #17
0
        public void Name_of_context_with_namespace_and_DbContext_stripped_is_found_in_app_config()
        {
            using (var internalConnection = new LazyInternalConnection("Couger35.Hubcap.ShortNameDbStrippedDbContext"))
            {
                var connection = internalConnection.Connection;

                Assert.Equal("Couger35.Hubcap.ShortNameDbStrippedDbContext", connection.Database);
                Assert.IsType <SqlConnection>(connection);
            }
        }
Example #18
0
        public void By_convention_name_does_not_have_DbContext_stripped()
        {
            using (var internalConnection = new LazyInternalConnection("Couger35.Hubcap.NameForFactoryDbContext"))
            {
                var connection = internalConnection.Connection;

                Assert.Equal("Couger35.Hubcap.NameForFactoryDbContext", connection.Database);
                Assert.IsType <SqlConnection>(connection);
            }
        }
Example #19
0
        public void Name_of_context_with_Context_stripped_is_not_found_in_app_config()
        {
            using (var internalConnection = new LazyInternalConnection("Couger35.Hubcap.FullNameStrippedContext"))
            {
                var connection = internalConnection.Connection;

                Assert.Equal("Couger35.Hubcap.FullNameStrippedContext", connection.Database);
                Assert.IsType <SqlConnection>(connection);
            }
        }
Example #20
0
        public void LazyInternalConnection_can_calculate_ConnectionHasModel_true_from_connection_string_without_initializing()
        {
            var efString = ConfigurationManager.ConnectionStrings["EntityConnectionString"].ConnectionString;

            using (var connection = new LazyInternalConnection(efString))
            {
                Assert.True(connection.ConnectionHasModel);
                Assert.False(connection.IsInitialized);
            }
        }
Example #21
0
 public void LazyInternalConnection_can_create_connection_from_DbConnectionInfo_from_config_file()
 {
     using (var connection = new LazyInternalConnection(new DbConnectionInfo("LazyConnectionTest")))
     {
         Assert.IsType <SqlCeConnection>(connection.Connection);
         Assert.Equal("ConnectionFromAppConfig.sdf", connection.Connection.Database);
         Assert.Equal("LazyConnectionTest", connection.ConnectionStringName);
         Assert.Equal(DbConnectionStringOrigin.DbContextInfo, connection.ConnectionStringOrigin);
     }
 }
Example #22
0
        public void LazyInternalConnection_can_calculate_ConnectionHasModel_false_after_initializing()
        {
            using (var connection = new LazyInternalConnection("name=LazyConnectionTest"))
            {
                var x = connection.Connection;
                Assert.True(connection.IsInitialized);

                Assert.False(connection.ConnectionHasModel);
            }
        }
        public void Name_of_context_with_DbContext_stripped_is_not_found_in_app_config()
        {
            using (var internalConnection = new LazyInternalConnection("Couger35.Hubcap.FullNameDbStrippedDbContext"))
            {
                var connection = internalConnection.Connection;

                Assert.Equal("Couger35.Hubcap.FullNameDbStrippedDbContext", connection.Database);
                Assert.IsType<SqlConnection>(connection);
            }
        }
Example #24
0
        public void Using_bad_connection_string_throws()
        {
            var expectedException = GenerateException(() => new SqlConnection("Step1=YouNeedToAsk?").Open());

            using (var internalConnection = new LazyInternalConnection("Step1=YouNeedToAsk?"))
            {
                Assert.Equal(
                    expectedException.Message, Assert.Throws <ArgumentException>(() => { var _ = internalConnection.Connection; }).Message);
            }
        }
Example #25
0
        public void Connection_from_factory_is_cached()
        {
            using (var internalConnection = new LazyInternalConnection("NameForFactory"))
            {
                var connection = internalConnection.Connection;

                Assert.Same(connection, internalConnection.Connection);
                Assert.Same(connection, internalConnection.Connection);
            }
        }
Example #26
0
        public void LazyInternalConnection_can_calculate_ConnectionHasModel_true_after_initializing()
        {
            using (var connection = new LazyInternalConnection("name=EntityConnectionString"))
            {
                var x = connection.Connection;
                Assert.True(connection.IsInitialized);

                Assert.True(connection.ConnectionHasModel);
            }
        }
        public void Name_of_context_with_namespace_stripped_is_found_in_app_config()
        {
            using (var internalConnection = new LazyInternalConnection("Couger35.Hubcap.ShortNameDbContext"))
            {
                var connection = internalConnection.Connection;

                Assert.Equal("ShortNameInAppConfig", connection.Database);
                Assert.IsType<SqlConnection>(connection);
            }
        }
Example #28
0
        public void Connection_from_hard_coded_connection_string_is_cached()
        {
            using (var internalConnection = new LazyInternalConnection("Database=HardCodedConnectionString"))
            {
                var connection = internalConnection.Connection;

                Assert.Same(connection, internalConnection.Connection);
                Assert.Same(connection, internalConnection.Connection);
            }
        }
Example #29
0
        public void Full_name_of_context_is_found_in_app_config()
        {
            using (var internalConnection = new LazyInternalConnection("Couger35.Hubcap.FullNameDbContext"))
            {
                var connection = internalConnection.Connection;

                Assert.Equal("FullNameInAppConfig", connection.Database);
                Assert.IsType <SqlConnection>(connection);
            }
        }
Example #30
0
        public void Default_IDbConnectionFactory_is_used_to_create_connection()
        {
            using (var internalConnection = new LazyInternalConnection("NameNotInAppConfig"))
            {
                var connection = internalConnection.Connection;

                Assert.Equal("NameNotInAppConfig", connection.Database);
                Assert.IsType <SqlConnection>(connection);
            }
        }
Example #31
0
        public void Connection_created_from_app_config_is_disposed_after_use()
        {
            var disposed = false;

            using (var internalConnection = new LazyInternalConnection("Couger35.Hubcap.FullNameDbContext"))
            {
                var connection = internalConnection.Connection;
                connection.Disposed += (_, __) => disposed = true;
            }
            Assert.True(disposed);
        }
Example #32
0
        public void Connection_created_from_hard_coded_connection_string_is_disposed_after_use()
        {
            var disposed = false;

            using (var internalConnection = new LazyInternalConnection("Database=HardCodedConnectionString"))
            {
                var connection = internalConnection.Connection;
                connection.Disposed += (_, __) => disposed = true;
            }
            Assert.True(disposed);
        }
Example #33
0
        public void Connection_created_from_factory_is_disposed_after_use()
        {
            var disposed = false;

            using (var internalConnection = new LazyInternalConnection("NameForFactory"))
            {
                var connection = internalConnection.Connection;
                connection.Disposed += (_, __) => disposed = true;
            }
            Assert.True(disposed);
        }
Example #34
0
 public void LazyInternalConnection_can_create_connection_from_DbConnectionInfo_with_connection_string()
 {
     using (
         var connection =
             new LazyInternalConnection(new DbConnectionInfo("Database=DatabaseFromDbConnectionInfo", "System.Data.SqlClient")))
     {
         Assert.IsType <SqlConnection>(connection.Connection);
         Assert.Equal("DatabaseFromDbConnectionInfo", connection.Connection.Database);
         Assert.Equal(null, connection.ConnectionStringName);
         Assert.Equal(DbConnectionStringOrigin.DbContextInfo, connection.ConnectionStringOrigin);
     }
 }
 public void Can_replace_connection()
 {
     using (var context = new ReplaceConnectionContext())
     {
         using (var newConnection = new LazyInternalConnection(
             context,
             new DbConnectionInfo(
                 SimpleConnectionString("NewReplaceConnectionContextDatabase"),
                 "System.Data.SqlClient")))
         {
             Can_replace_connection_implementation(context, newConnection);
         }
     }
 }
 public void Can_replace_connection_with_different_provider()
 {
     using (var context = new ReplaceConnectionContext())
     {
         using (var newConnection = new LazyInternalConnection(
             context,
             new DbConnectionInfo(
                 "Data Source=NewReplaceConnectionContextDatabase.sdf",
                 "System.Data.SqlServerCe.4.0")))
         {
             Can_replace_connection_implementation(context, newConnection);
         }
     }
 }
        public void By_convention_name_does_not_have_DbContext_stripped()
        {
            using (var internalConnection = new LazyInternalConnection("Couger35.Hubcap.NameForFactoryDbContext"))
            {
                var connection = internalConnection.Connection;

                Assert.Equal("Couger35.Hubcap.NameForFactoryDbContext", connection.Database);
                Assert.IsType<SqlConnection>(connection);
            }
        }
        public void Connection_from_factory_is_cached()
        {
            using (var internalConnection = new LazyInternalConnection("NameForFactory"))
            {
                var connection = internalConnection.Connection;

                Assert.Same(connection, internalConnection.Connection);
                Assert.Same(connection, internalConnection.Connection);
            }
        }
 public void LazyInternalConnection_can_calculate_ConnectionHasModel_true_from_DbConnectionInfo_without_initializing()
 {
     using (var connection = new LazyInternalConnection(new DbConnectionInfo("EntityConnectionString")))
     {
         Assert.True(connection.ConnectionHasModel);
         Assert.False(connection.IsInitialized);
     }
 }
        public void LazyInternalConnection_can_calculate_ConnectionHasModel_false_after_initializing()
        {
            using (var connection = new LazyInternalConnection("name=LazyConnectionTest"))
            {
                var x = connection.Connection;
                Assert.True(connection.IsInitialized);

                Assert.False(connection.ConnectionHasModel);
            }
        }
 public void Changed_default_connection_factory_that_results_in_null_connections_throws()
 {
     var existingFactory = DefaultConnectionFactoryResolver.Instance.ConnectionFactory;
     try
     {
         DefaultConnectionFactoryResolver.Instance.ConnectionFactory = new Mock<IDbConnectionFactory>().Object;
         using (var internalConnection = new LazyInternalConnection("NameNotInAppConfig"))
         {
             Assert.Equal(
                 Strings.DbContext_ConnectionFactoryReturnedNullConnection,
                 Assert.Throws<InvalidOperationException>(() => { var _ = internalConnection.Connection; }).Message);
         }
     }
     finally
     {
         DefaultConnectionFactoryResolver.Instance.ConnectionFactory = existingFactory;
     }
 }
 public void LazyInternalConnection_can_calculate_ConnectionHasModel_true_from_config_file_without_initializing()
 {
     using (var connection = new LazyInternalConnection("name=EntityConnectionString"))
     {
         Assert.True(connection.ConnectionHasModel);
         Assert.False(connection.IsInitialized);
     }
 }
 public void Connection_created_from_app_config_is_disposed_after_use()
 {
     var disposed = false;
     using (var internalConnection = new LazyInternalConnection("Couger35.Hubcap.FullNameDbContext"))
     {
         var connection = internalConnection.Connection;
         connection.Disposed += (_, __) => disposed = true;
     }
     Assert.True(disposed);
 }
 public void Connection_created_from_hard_coded_connection_string_is_disposed_after_use()
 {
     var disposed = false;
     using (var internalConnection = new LazyInternalConnection("Database=HardCodedConnectionString"))
     {
         var connection = internalConnection.Connection;
         connection.Disposed += (_, __) => disposed = true;
     }
     Assert.True(disposed);
 }
 public void LazyInternalConnection_ConnectionHasModel_without_initializing_throws_when_connection_not_in_config_DbConnectionInfo()
 {
     using (var connection = new LazyInternalConnection(new DbConnectionInfo("WontFindMe")))
     {
         Assert.Equal(
             Strings.DbConnectionInfo_ConnectionStringNotFound("WontFindMe"),
             Assert.Throws<InvalidOperationException>(() => { var temp = connection.ConnectionHasModel; }).Message);
     }
 }
 public void LazyInternalConnection_provider_name_calculated_when_connection_from_config()
 {
     using (var connection = new LazyInternalConnection("name=LazyConnectionTest"))
     {
         Assert.Equal("System.Data.SqlServerCe.4.0", connection.ProviderName);
     }
 }
 public void LazyInternalConnection_provider_name_calculated_when_connection_by_convention()
 {
     using (var connection = new LazyInternalConnection("ConnectionName"))
     {
         Assert.Equal("System.Data.SqlClient", connection.ProviderName);
     }
 }
 public void LazyInternalConnection_provider_name_calculated_when_connection_from_DbConnectionInfo()
 {
     using (
         var connection =
             new LazyInternalConnection(
                 new DbConnectionInfo("Data Source=ConnectionFromDbConnectionInfo.sdf", "System.Data.SqlServerCe.4.0")))
     {
         Assert.Equal("System.Data.SqlServerCe.4.0", connection.ProviderName);
     }
 }
        public void Disposed_LazyInternalConnection_can_be_reused()
        {
            var internalConnection = new LazyInternalConnection("NameForFactory");
            try
            {
                var disposed1 = 0;
                var disposed2 = 0;

                var connection1 = internalConnection.Connection;
                connection1.Disposed += (_, __) => disposed1++;

                internalConnection.Dispose();
                Assert.Equal(1, disposed1);
                Assert.Equal(0, disposed2);

                var connection2 = internalConnection.Connection;
                connection2.Disposed += (_, __) => disposed2++;

                internalConnection.Dispose();
                Assert.Equal(1, disposed1);
                Assert.Equal(1, disposed2);
            }
            finally
            {
                internalConnection.Dispose();
            }
        }
 public void Connection_created_from_factory_is_disposed_after_use()
 {
     var disposed = false;
     using (var internalConnection = new LazyInternalConnection("NameForFactory"))
     {
         var connection = internalConnection.Connection;
         connection.Disposed += (_, __) => disposed = true;
     }
     Assert.True(disposed);
 }
        public void LazyInternalConnection_can_calculate_ConnectionHasModel_true_from_connection_string_without_initializing()
        {
            var efString = ConfigurationManager.ConnectionStrings["EntityConnectionString"].ConnectionString;

            using (var connection = new LazyInternalConnection(efString))
            {
                Assert.True(connection.ConnectionHasModel);
                Assert.False(connection.IsInitialized);
            }
        }
        public void LazyInternalConnection_can_calculate_ConnectionHasModel_true_after_initializing()
        {
            using (var connection = new LazyInternalConnection("name=EntityConnectionString"))
            {
                var x = connection.Connection;
                Assert.True(connection.IsInitialized);

                Assert.True(connection.ConnectionHasModel);
            }
        }
        public void LazyInternalConnection_can_create_connection_from_DbConnectionInfo_from_overridden_config_file()
        {
            using (var connection = new LazyInternalConnection(new DbConnectionInfo("LazyConnectionTest")))
            {
                connection.AppConfig =
                    new AppConfig(
                        CreateEmptyConfig().AddConnectionString(
                            "LazyConnectionTest", "Database=FromOverridenConfig", "System.Data.SqlClient"));

                Assert.IsType<SqlConnection>(connection.Connection);
                Assert.Equal("FromOverridenConfig", connection.Connection.Database);
                Assert.Equal("LazyConnectionTest", connection.ConnectionStringName);
                Assert.Equal(DbConnectionStringOrigin.DbContextInfo, connection.ConnectionStringOrigin);
            }
        }
        public void Explicit_name_is_used_without_stripping_DbContext()
        {
            using (var internalConnection = new LazyInternalConnection("Couger35.Hubcap.NameForFactoryDbContext"))
            {
                var connection = internalConnection.Connection;

                Assert.Equal("Couger35.Hubcap.NameForFactoryDbContext", connection.Database);
                Assert.IsType<SqlConnection>(connection);
            }
        }
        public void Changed_by_convention_IDbConnectionFactory_is_used_to_create_connection()
        {
            var existingFactory = DefaultConnectionFactoryResolver.Instance.ConnectionFactory;
            try
            {
                var mockFactory = new Mock<IDbConnectionFactory>();
                mockFactory.Setup(f => f.CreateConnection(It.IsAny<string>())).Returns(new SqlConnection());

                DefaultConnectionFactoryResolver.Instance.ConnectionFactory = mockFactory.Object;
                using (var internalConnection = new LazyInternalConnection("NameNotInAppConfig"))
                {
                    var connection = internalConnection.Connection;
                }

                mockFactory.Verify(f => f.CreateConnection("NameNotInAppConfig"));
            }
            finally
            {
                DefaultConnectionFactoryResolver.Instance.ConnectionFactory = existingFactory;
            }
        }
 public void LazyInternalConnection_can_calculate_ConnectionHasModel_false_from_convention_without_initializing()
 {
     using (var connection = new LazyInternalConnection("MyName"))
     {
         Assert.False(connection.ConnectionHasModel);
         Assert.False(connection.IsInitialized);
     }
 }
 public void LazyInternalConnection_can_create_connection_from_DbConnectionInfo_from_config_file()
 {
     using (var connection = new LazyInternalConnection(new DbConnectionInfo("LazyConnectionTest")))
     {
         Assert.IsType<SqlCeConnection>(connection.Connection);
         Assert.Equal("ConnectionFromAppConfig.sdf", connection.Connection.Database);
         Assert.Equal("LazyConnectionTest", connection.ConnectionStringName);
         Assert.Equal(DbConnectionStringOrigin.DbContextInfo, connection.ConnectionStringOrigin);
     }
 }
 public void LazyInternalConnection_throws_when_cant_find_connection_from_DbConnectionInfo_in_config_file()
 {
     using (var connection = new LazyInternalConnection(new DbConnectionInfo("YouWontFindMe")))
     {
         Assert.Equal(
             Strings.DbConnectionInfo_ConnectionStringNotFound("YouWontFindMe"),
             Assert.Throws<InvalidOperationException>(() => { var temp = connection.Connection; }).Message);
     }
 }
 public void Can_replace_connection()
 {
     using (var context = new ReplaceConnectionContext())
     using (var newConnection = new LazyInternalConnection(new DbConnectionInfo(
                                                               @"Server=.\SQLEXPRESS;Database=NewReplaceConnectionContextDatabase;Trusted_Connection=True;",
                                                               "System.Data.SqlClient")))
     {
         Can_replace_connection_implementation(context, newConnection);
     }
 }
 public void LazyInternalConnection_can_create_connection_from_DbConnectionInfo_with_connection_string()
 {
     using (
         var connection =
             new LazyInternalConnection(new DbConnectionInfo("Database=DatabaseFromDbConnectionInfo", "System.Data.SqlClient")))
     {
         Assert.IsType<SqlConnection>(connection.Connection);
         Assert.Equal("DatabaseFromDbConnectionInfo", connection.Connection.Database);
         Assert.Equal(null, connection.ConnectionStringName);
         Assert.Equal(DbConnectionStringOrigin.DbContextInfo, connection.ConnectionStringOrigin);
     }
 }