public void Assignment_DeleteUser_Test()
        {
            //Arrange
            UserSqlDAL dao = new UserSqlDAL(ConnectionString);

            User inputUser = new User();

            inputUser.Password = "******";
            inputUser.Salt     = "NuE0Y6FonAI=";
            inputUser.Role     = "Teacher";
            inputUser.Username = "******";


            dao.CreateUser(inputUser);

            int test = GetRowCount("users");

            inputUser = dao.GetUser(inputUser.Username);
            //Action
            dao.DeleteUser(inputUser);
            int result = GetRowCount("users");

            //Assert
            Assert.AreEqual(result, test - 1);
        }
        public void DeleteUserTest()
        {
            int result;

            User testUser = new User();

            using (SqlConnection connection = new SqlConnection(ConnectionString))
            {
                connection.Open();
                SqlCommand cmd = connection.CreateCommand();
                cmd.CommandText = @"select * from UserLogin where userName = '******'";
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    testUser.Name     = (string)reader["first_Last_Name"];
                    testUser.Role     = (string)reader["userRole"];
                    testUser.Password = (string)reader["password"];
                    testUser.UserId   = (int)reader["userId"];
                    testUser.Username = (string)reader["userName"];
                }
            }


            dao.DeleteUser(testUser.UserId, testUser.UserId);

            using (SqlConnection connection = new SqlConnection(ConnectionString))
            {
                connection.Open();
                SqlCommand cmd = connection.CreateCommand();
                cmd.CommandText = @"select * from UserLogin where userName = '******'";
                result          = Convert.ToInt32(cmd.ExecuteScalar());
            }

            Assert.AreNotEqual(0, result);

            dao.DeleteUser(testUser.UserId, 999999);

            using (SqlConnection connection = new SqlConnection(ConnectionString))
            {
                connection.Open();
                SqlCommand cmd = connection.CreateCommand();
                cmd.CommandText = @"select * from UserLogin where userName = '******'";
                result          = Convert.ToInt32(cmd.ExecuteScalar());
            }
            Assert.AreEqual(0, result);
        }