public async Task ChangeCheckReturnRoleNull_Test()
        {
            Role role      = null;
            var  editModel = new EditModel {
                userId = 2, roleId = 3
            };
            var mock = new Mock <IUserService>();

            mock.Setup(repo => repo.ChangeUserRole(editModel.userId, editModel.roleId)).Returns(async() => { return(role); });

            var editController = new UserEditController(mock.Object);

            Exception ex = await Assert.ThrowsAsync <Exception>(() => editController.ChangeRole(editModel));

            Assert.Equal("Role is not change!", ex.Message);
        }
        public void ChangeCheckReturnRole_Test()
        {
            User user = new User {
                Id = 2, UserName = "******", Password = "******", RoleId = 2, Role = new Role {
                    Name = "user"
                }
            };
            var editModel = new EditModel {
                userId = 2, roleId = 1
            };
            var mock = new Mock <IUserService>();

            mock.Setup(repo => repo.ChangeUserRole(editModel.userId, editModel.roleId)).Returns(async() => { return(user.Role); });

            var editController = new UserEditController(mock.Object);

            var result = editController.ChangeRole(editModel);

            Assert.IsType <Role>(result.Result);
        }