コード例 #1
0
        public void generate_connectionString_with_basic_values()
        {
            MySqlConnectionString mySqlConnectionString = new MySqlConnectionString();

            string connectionString = mySqlConnectionString.GetConnectionString();

            Assert.AreEqual("Server=;Database=;", connectionString);
        }
コード例 #2
0
        public void generate_connectionString_with_Server_Database_and_CertificatePassword()
        {
            MySqlConnectionString mySqlConnectionString = new MySqlConnectionString()
            {
                Server              = "server",
                Database            = "database",
                CertificatePassword = "******"
            };

            string connectionString = mySqlConnectionString.GetConnectionString();

            Assert.AreEqual("Server=server;Database=database;CertificatePassword=certificate;", connectionString);
        }
コード例 #3
0
        public void generate_connectionString_with_Server_Database_and_SSLMode_Required()
        {
            MySqlConnectionString mySqlConnectionString = new MySqlConnectionString()
            {
                Server   = "server",
                Database = "database",
                SSLMode  = MySqlConnectionString.SSLModes.Required
            };

            string connectionString = mySqlConnectionString.GetConnectionString();

            Assert.AreEqual("Server=server;Database=database;SslMode=Required;", connectionString);
        }
コード例 #4
0
        public void generate_connectionString_with_Server_Database_and_AllowBatch()
        {
            MySqlConnectionString mySqlConnectionString = new MySqlConnectionString()
            {
                Server     = "server",
                Database   = "database",
                AllowBatch = false
            };

            string connectionString = mySqlConnectionString.GetConnectionString();

            Assert.AreEqual("Server=server;Database=database;AllowBatch=False;", connectionString);
        }
        public void create_basic_connectionString_with_IntegratedSecurity()
        {
            MySqlConnectionString mySqlConnectionStringExpected = new MySqlConnectionString()
            {
                Server             = "server",
                Database           = "database",
                IntegratedSecurity = true
            };
            MySqlConnectionString mySqlConnectionStringBuilder = new MySqlConnectionStringBuilder("server", "database");


            Assert.AreEqual(mySqlConnectionStringExpected.GetConnectionString(), mySqlConnectionStringBuilder.GetConnectionString());
        }
コード例 #6
0
        public void generate_connectionString_with_Server_Database_and_Port()
        {
            MySqlConnectionString mySqlConnectionString = new MySqlConnectionString()
            {
                Server   = "server",
                Database = "database",
                Port     = 8080
            };

            string connectionString = mySqlConnectionString.GetConnectionString();

            Assert.AreEqual("Server=server;Database=database;Port=8080;", connectionString);
        }
コード例 #7
0
        public void generate_connectionString_with_Server_Database_and_DefaultCommandTimeout()
        {
            MySqlConnectionString mySqlConnectionString = new MySqlConnectionString()
            {
                Server   = "server",
                Database = "database",
                DefaultCommandTimeout = 20
            };

            string connectionString = mySqlConnectionString.GetConnectionString();

            Assert.AreEqual("Server=server;Database=database;default command timeout=20;", connectionString);
        }
コード例 #8
0
        public void generate_connectionString_with_Server_Database_and_IntegratedSecurity()
        {
            MySqlConnectionString mySqlConnectionString = new MySqlConnectionString
            {
                Server             = "server",
                Database           = "database",
                IntegratedSecurity = true
            };

            string connectionString = mySqlConnectionString.GetConnectionString();

            Assert.AreEqual("Server=server;Database=database;IntegratedSecurity=yes;", connectionString);
        }
コード例 #9
0
        public void generate_connectionString_with_Server_Database_and_Encription()
        {
            MySqlConnectionString mySqlConnectionString = new MySqlConnectionString()
            {
                Server   = "server",
                Database = "database",
                Encrypt  = true
            };

            string connectionString = mySqlConnectionString.GetConnectionString();

            Assert.AreEqual("Server=server;Database=database;Encrypt=true;", connectionString);
        }
コード例 #10
0
        public void generate_connectionString_with_Server_Database_and_ConnectionTimeout()
        {
            MySqlConnectionString mySqlConnectionString = new MySqlConnectionString()
            {
                Server            = "server",
                Database          = "database",
                ConnectionTimeout = 5
            };

            string connectionString = mySqlConnectionString.GetConnectionString();

            Assert.AreEqual("Server=server;Database=database;Connection Timeout=5;", connectionString);
        }
コード例 #11
0
        public void generate_connectionString_with_Server_Database_and_AllowZeroDateTime()
        {
            MySqlConnectionString mySqlConnectionString = new MySqlConnectionString()
            {
                Server            = "server",
                Database          = "database",
                AllowZeroDateTime = true
            };

            string connectionString = mySqlConnectionString.GetConnectionString();

            Assert.AreEqual("Server=server;Database=database;AllowZeroDateTime=True;", connectionString);
        }
コード例 #12
0
        public void generate_connectionString_with_Server_Database_user_and_password()
        {
            MySqlConnectionString mySqlConnectionString = new MySqlConnectionString
            {
                Server   = "server",
                Database = "database",
                User     = "******",
                Password = "******"
            };

            string connectionString = mySqlConnectionString.GetConnectionString();

            Assert.AreEqual("Server=server;Database=database;Uid=user;Pwd=password;", connectionString);
        }
        public void not_add_Password_and_no_removes_IntegratedSecurity_to_ConnectionString_when_Password_is_Null()
        {
            MySqlConnectionString mySqlConnectionStringExpected = new MySqlConnectionString()
            {
                Server             = "server",
                Database           = "database",
                IntegratedSecurity = true
            };
            MySqlConnectionString mySqlConnectionStringBuilder =
                new MySqlConnectionStringBuilder("server", "database").WithPassword(null);


            Assert.AreEqual(mySqlConnectionStringExpected.GetConnectionString(), mySqlConnectionStringBuilder.GetConnectionString());
        }
        public void not_add_User_and_no_removes_IntegratedSecurity_to_ConnectionString_when_User_is_Empty()
        {
            MySqlConnectionString mySqlConnectionStringExpected = new MySqlConnectionString()
            {
                Server             = "server",
                Database           = "database",
                IntegratedSecurity = true
            };
            MySqlConnectionString mySqlConnectionStringBuilder =
                new MySqlConnectionStringBuilder("server", "database").WithUser(string.Empty);


            Assert.AreEqual(mySqlConnectionStringExpected.GetConnectionString(), mySqlConnectionStringBuilder.GetConnectionString());
        }
        public void add_User_and_removes_IntegratedSecurity_to_ConnectionString_when_User_contains_text()
        {
            MySqlConnectionString mySqlConnectionStringExpected = new MySqlConnectionString()
            {
                Server   = "server",
                Database = "database",
                User     = "******"
            };
            MySqlConnectionString mySqlConnectionStringBuilder =
                new MySqlConnectionStringBuilder("server", "database").WithUser("user");


            Assert.AreEqual(mySqlConnectionStringExpected.GetConnectionString(), mySqlConnectionStringBuilder.GetConnectionString());
        }
        public void remove_User_and_Password_when_sets_true_IntegratedSecurity()
        {
            MySqlConnectionString mySqlConnectionStringExpected = new MySqlConnectionString()
            {
                Server             = "server",
                Database           = "database",
                IntegratedSecurity = true
            };
            MySqlConnectionString mySqlConnectionStringBuilder =
                new MySqlConnectionStringBuilder("server", "database", "user", "password").WithIntegratedSecurity(true);


            Assert.AreEqual(mySqlConnectionStringExpected.GetConnectionString(), mySqlConnectionStringBuilder.GetConnectionString());
        }
        public void create_basic_connectionString_with_User_and_Password()
        {
            MySqlConnectionString mySqlConnectionStringExpected = new MySqlConnectionString()
            {
                Server   = "server",
                Database = "database",
                User     = "******",
                Password = "******"
            };
            MySqlConnectionString mySqlConnectionStringBuilder = new MySqlConnectionStringBuilder("server", "database", "user", "password");


            Assert.AreEqual(mySqlConnectionStringExpected.GetConnectionString(), mySqlConnectionStringBuilder.GetConnectionString());
        }
        public void add_WithSSLMode_to_ConnectionString()
        {
            MySqlConnectionString mySqlConnectionStringExpected = new MySqlConnectionString()
            {
                Server             = "server",
                Database           = "database",
                IntegratedSecurity = true,
                SSLMode            = MySqlConnectionString.SSLModes.Preferred
            };
            MySqlConnectionString mySqlConnectionStringBuilder =
                new MySqlConnectionStringBuilder("server", "database").WithSSLMode(MySqlConnectionString.SSLModes.Preferred);


            Assert.AreEqual(mySqlConnectionStringExpected.GetConnectionString(), mySqlConnectionStringBuilder.GetConnectionString());
        }
        public void add_Encrypt_to_ConnectionString()
        {
            MySqlConnectionString mySqlConnectionStringExpected = new MySqlConnectionString()
            {
                Server             = "server",
                Database           = "database",
                IntegratedSecurity = true,
                Encrypt            = true
            };
            MySqlConnectionString mySqlConnectionStringBuilder =
                new MySqlConnectionStringBuilder("server", "database").WithEncrypt(true);


            Assert.AreEqual(mySqlConnectionStringExpected.GetConnectionString(), mySqlConnectionStringBuilder.GetConnectionString());
        }
        public void add_CertificatePassword_to_ConnectionString()
        {
            MySqlConnectionString mySqlConnectionStringExpected = new MySqlConnectionString()
            {
                Server              = "server",
                Database            = "database",
                IntegratedSecurity  = true,
                CertificatePassword = "******"
            };
            MySqlConnectionString mySqlConnectionStringBuilder =
                new MySqlConnectionStringBuilder("server", "database").WithCertificatePassword("certificate password");


            Assert.AreEqual(mySqlConnectionStringExpected.GetConnectionString(), mySqlConnectionStringBuilder.GetConnectionString());
        }
        public void add_ConnectionTimeout_to_ConnectionString()
        {
            MySqlConnectionString mySqlConnectionStringExpected = new MySqlConnectionString()
            {
                Server             = "server",
                Database           = "database",
                IntegratedSecurity = true,
                ConnectionTimeout  = 222
            };
            MySqlConnectionString mySqlConnectionStringBuilder =
                new MySqlConnectionStringBuilder("server", "database").WithConnectionTimeout(222);


            Assert.AreEqual(mySqlConnectionStringExpected.GetConnectionString(), mySqlConnectionStringBuilder.GetConnectionString());
        }
        public void add_AllowZeroDateTime_to_ConnectionString()
        {
            MySqlConnectionString mySqlConnectionStringExpected = new MySqlConnectionString()
            {
                Server             = "server",
                Database           = "database",
                IntegratedSecurity = true,
                AllowZeroDateTime  = true
            };
            MySqlConnectionString mySqlConnectionStringBuilder =
                new MySqlConnectionStringBuilder("server", "database").WithAllowZeroDateTime(true);


            Assert.AreEqual(mySqlConnectionStringExpected.GetConnectionString(), mySqlConnectionStringBuilder.GetConnectionString());
        }