Exemplo n.º 1
0
        private void btnDeleteCGUser_Click(object sender, EventArgs e)
        {
            string userName = CGUserNameTextBox.Text;

            if (!string.IsNullOrEmpty(userName))
            {
                CGUserModel cgu    = cGUserController.GetUserByUserName(userName);
                bool        delete = cGUserController.DeleteCGUser(cgu);
                if (delete)
                {
                    DeleteUserlabel.ForeColor = Color.Green;
                    DeleteUserlabel.Text      = "CGUser is deleted " + " User Name: " + CGUserNameTextBox.Text;
                    UpdateCGUsersListBox();
                }
            }
            else
            {
                DeleteUserlabel.ForeColor = Color.Red;
                DeleteUserlabel.Text      = "Input valid userId !";
            }
        }
Exemplo n.º 2
0
        public void GetUserByUserNameTest()
        {
            //Arrange
            CGUserController   cGUserController = new CGUserController();
            CGUserModel        user1 = null, user2 = null;
            List <CGUserModel> users = cGUserController.GetAll();

            if (users.Count > 0)
            {
                user1 = users[0];
            }

            //Act
            user2 = cGUserController.GetUserByUserName(user1.UserName);

            //Assert
            Assert.AreEqual(user1.Email, user2.Email);
        }