Ejemplo n.º 1
0
        //checks if the Update method fails with incorrect info
        public void TestUpdateFail()
        {
            DBTest db    = new DBTest();
            string query = "UPDATE 17agileteam6db.users SET first_name = 32 WHERE user_ID = 'ew'";

            Assert.AreEqual(false, db.Update(query));
        }
Ejemplo n.º 2
0
        //Checks if insert fails when given bad values
        public void TestInsertfail()
        {
            DBTest db    = new DBTest();
            string query = "INSERT INTO 17agileteam6db.users VALUES (1, 3, 4, 'Engineering', 0, 'guest')";

            Assert.AreEqual(false, db.Insert(query));
        }
Ejemplo n.º 3
0
        //checks if the update method works correctly with correct info.
        public void TestUpdateSuccess()
        {
            DBTest db    = new DBTest();
            string query = "UPDATE 17agileteam6db.users SET first_name = 'Dan' WHERE user_ID = 3";

            Assert.AreEqual(true, db.Update(query));
        }
Ejemplo n.º 4
0
        //checks if user uses wrong credentials
        public void FailedLogin()
        {
            string username = "******";
            string password = "******";
            string query    = "SELECT * FROM 17agileteam6db.users WHERE staff_no ='" + username + "' AND pass = '******'";
            DBTest db       = new DBTest();
            bool   login    = false;

            MySql.Data.MySqlClient.MySqlDataReader reader = db.Select(query);

            while (reader.HasRows && reader.Read())
            {
                string info = reader.GetString(reader.GetOrdinal("role"));
            }

            if (reader.HasRows)
            {
                login = true;
            }
            else
            {
                login = false;
            }
            reader.Close();
            Assert.AreEqual(false, login);
        }
Ejemplo n.º 5
0
        //checks if insert is working Correctly if given correct values
        public void TestInsertSuccess()
        {
            DBTest db     = new DBTest();
            string query  = "INSERT INTO 17agileteam6db.users (user_ID, staff_no, first_name, last_name, email, department, role, pass) VALUES(9, '20XO10', 'LiAM', 'Collins', '*****@*****.**', 'Engineering', 0, 'guest')";
            bool   insert = db.Insert(query);

            Assert.AreEqual(true, insert);
        }
Ejemplo n.º 6
0
        //Checks if the History Works with signing
        public void SignHistoryTest()
        {
            string role = "RIS";
            bool   worked;
            int    project_ID = 3;
            DBTest db         = new DBTest();

            worked = db.History(project_ID, role, "Signed", " ");

            Assert.AreEqual(worked, true);
        }
Ejemplo n.º 7
0
        //Checks if it Signs Correctly
        public void SignTest()
        {
            string role       = "RIS";
            int    project_ID = 2;
            DBTest db         = new DBTest();
            string query      = "UPDATE 17agileteam6db.projects SET " + role + "_accepted = 1 WHERE project_ID = " + project_ID;

            bool worked = db.Insert(query);

            Assert.AreEqual(worked, true);
        }
Ejemplo n.º 8
0
        //Uploads to history Table
        public void TestHistoryUpload()
        {
            DBTest db         = new DBTest();
            string user       = "******";
            string comment    = "Uploaded the file";
            int    project_ID = 3;
            string action     = "Upload";
            string query      = "INSERT INTO 17agileteam6db.history (project_ID, user, Historycol, date_time, projectAction, Comments) VALUES (" + project_ID + ", '" + user + "', ' ', NOW(), '" + action + "', '" + comment + "')";

            bool insert = db.Insert(query);

            Assert.AreEqual(true, insert);
        }
Ejemplo n.º 9
0
        public void SuccessHistory()
        {
            string user  = "******";
            string query = "SELECT * FROM 17agileteam6db.history WHERE user = '******'";
            DBTest db    = new DBTest();
            string info  = "";

            MySql.Data.MySqlClient.MySqlDataReader reader = db.Select(query);

            while (reader.HasRows && reader.Read())
            {
                info = reader.GetString(reader.GetOrdinal("projectAction"));
            }

            Assert.AreEqual("Upload", info);
        }
Ejemplo n.º 10
0
        //tests if the connection is made
        public void TestOpenConnection()
        {
            DBTest db = new DBTest();

            Assert.AreEqual(true, db.OpenConnection());
        }