public void ClearTableTest()
        {
            DBConnectionHelper.Init(_ProjectPath.projectPath + @"\DB\Database_Test.mdb");
            string table = DBConnectionHelper._tableBuddy;

            DBConnectionHelper.ClearTable(table);
            Thread.Sleep(1000);
            List <Record> list   = DBConnectionHelper.ReadUserRecords();
            int           before = list.Count;

            if (before == 0)
            {
                DBConnectionHelper.ExecuteNonQuery(DBConnectionHelper.MakeSQLInsertQuery(DBConnectionHelper._tableUser, new String[] { DBConnectionHelper._columnName,
                                                                                                                                       DBConnectionHelper._columPasword,
                                                                                                                                       DBConnectionHelper._columnEmail,
                                                                                                                                       DBConnectionHelper._columnGuid },
                                                                                         new String[] { "Username",
                                                                                                        "Password",
                                                                                                        "*****@*****.**",
                                                                                                        Guid.NewGuid().ToString() }));
                Thread.Sleep(1000);
                before = (list = DBConnectionHelper.ReadUserRecords()).Count;
            }
            Assert.IsTrue(before > 0, "No entries in table");

            table = DBConnectionHelper._tableUser;
            DBConnectionHelper.ClearTable(table);
            Thread.Sleep(1000);
            int after = (list = DBConnectionHelper.ReadUserRecords()).Count;

            Assert.AreEqual(0, after);
        }
        public void InitTest()
        {
            string dbPath = string.Empty; // TODO: Passenden Wert initialisieren

            DBConnectionHelper.Init(dbPath);
            Assert.IsFalse(String.IsNullOrEmpty(DBConnectionHelper._columnBuddyBuddy), "_columnBuddyBuddy is null or empty. config was not read");
            Assert.IsFalse(String.IsNullOrEmpty(DBConnectionHelper._columnBuddyUser), "_columnBuddyUser is null or empty. config was not read");
            Assert.IsFalse(String.IsNullOrEmpty(DBConnectionHelper._columnEmail), "_columnEmail is null or empty. config was not read");
            Assert.IsFalse(String.IsNullOrEmpty(DBConnectionHelper._columnGuid), "_columnGuid is null or empty. config was not read");
            Assert.IsFalse(String.IsNullOrEmpty(DBConnectionHelper._columnName), "_columnName is null or empty. config was not read");
            Assert.IsFalse(String.IsNullOrEmpty(DBConnectionHelper._columPasword), "_columPasword is null or empty. config was not read");
            Assert.IsFalse(String.IsNullOrEmpty(DBConnectionHelper._tableBuddy), "_tableBuddy is null or empty. config was not read");
            Assert.IsFalse(String.IsNullOrEmpty(DBConnectionHelper._tableUser), "_tableUser is null or empty. config was not read");
        }
Exemple #3
0
 public void Setup()
 {
     /*ConfigurationManager.OpenExeConfiguration(_ProjectPath.projectPath + "\\Web.config");
      * Thread.Sleep(1000);
      * ConfigurationManager.RefreshSection("appSettings");
      * foreach (String item in ConfigurationManager.AppSettings.AllKeys) {
      *  String value =  ConfigurationManager.AppSettings[item];
      * }
      */
     DBConnectionHelper.Init(_ProjectPath.projectPath + @"\DB\Database_Test.mdb");
     DBConnectionHelper._columnBuddyBuddy = "CUser";
     DBConnectionHelper._columnBuddyUser  = "******";
     DBConnectionHelper._columnEmail      = "CEmail";
     DBConnectionHelper._columnGuid       = "CGuid";
     DBConnectionHelper._columnName       = "CName";
     DBConnectionHelper._columPasword     = "CPassword";
     DBConnectionHelper._tableBuddy       = "TBuddies";
     DBConnectionHelper._tableUser        = "******";
     DBConnectionHelper.ClearTable(DBConnectionHelper._tableBuddy);
     DBConnectionHelper.ClearTable(DBConnectionHelper._tableUser);
 }
 public void Setup()
 {
     DBConnectionHelper.Init(_ProjectPath.projectPath + @"\DB\Database_Test.mdb");
     DBConnectionHelper.ClearTable(DBConnectionHelper._tableBuddy);
     DBConnectionHelper.ClearTable(DBConnectionHelper._tableUser);
 }