コード例 #1
0
        public void LoadDatabaseConfigTest()
        {
            IDatabaseSettings oSettings = new XMLDatabaseSettings();
            oSettings.LoadDatabaseConfiguration(_exampleFiles + "DB_Config.xml");

            Assert.AreEqual("ODS_production", oSettings.Database);
            Assert.AreEqual("MAINODS001", oSettings.DataSource);
            Assert.AreEqual("sqloledb", oSettings.Provider);
            Assert.AreEqual("datatel", oSettings.Username);
        }
コード例 #2
0
        public void OpenConnectionTest()
        {
            IDatabaseSettings oSettings = new XMLDatabaseSettings();
            oSettings.LoadDatabaseConfiguration();

            IDatabase oDB = new SQLServer(oSettings);
            
            oDB.OpenConnection();
            Assert.IsTrue(oDB.ConnectionStatus);
            oDB.CloseConnection();
            Assert.IsFalse(oDB.ConnectionStatus);
        }
コード例 #3
0
        public void Create_ConfigTest()
        {
            IDatabaseSettings oSettings = new XMLDatabaseSettings();
            oSettings.Database = "local";
            oSettings.DataSource = "localhost";
            oSettings.Password = "******";
            oSettings.Provider = "sqloledb";
            oSettings.Username = "******";

            oSettings.CreateConfigurationFile(_exampleFiles + "DB_Config_Test.xml");
            Assert.IsTrue(oSettings.ConfigurationFileExists());

            Assert.AreEqual(oSettings.ConfigurationLocation, _exampleFiles + "DB_Config_Test.xml");
            Assert.AreEqual(oSettings.Database, "local");
            Assert.AreEqual(oSettings.DataSource, "localhost");
            Assert.AreEqual(oSettings.Password, "Budman%88");
            Assert.AreEqual(oSettings.Provider, "sqloledb");
            Assert.AreEqual(oSettings.Username, "sdt\\myoung");

            System.IO.File.Delete(_exampleFiles + "DB_Config_Test.xml");
        }