コード例 #1
0
        public void DeleteTest()
        {
            //Arrange
            CGUserController cGUserController = new CGUserController();
            CGUserModel      userModel        = new CGUserModel {
                Id       = "Test2",
                Email    = "*****@*****.**",
                UserName = "******"
            };

            cGUserController.CreateUser("Test2", "*****@*****.**", "TestUser");
            List <CGUserModel> users = cGUserController.GetAll();

            foreach (var user in users)
            {
                if (user.UserName == "TestUser")
                {
                    userModel = user;
                }
            }
            bool res = false;

            //Act
            res = cGUserController.DeleteCGUser(userModel);

            //Assert
            Assert.IsTrue(res);
        }
コード例 #2
0
        private void UpdateCGUsersListBox()
        {
            var allUsers = cGUserController.GetAll();

            listBoxCGUsers.Items.Clear();
            foreach (CGUserModel cgu in allUsers)
            {
                listBoxCGUsers.Items.Add(cgu);
            }
        }
コード例 #3
0
        public void GetAllTest()
        {
            //Arrange
            CGUserController cGUserController = new CGUserController();

            //Act
            List <CGUserModel> users = cGUserController.GetAll();

            //Assert
            Assert.IsTrue(users.Count > 0);
        }
コード例 #4
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);
        }