示例#1
0
        public async Task <ActionResult> UpdateUserAsync(UserUpdateVm user)
        {
            var userId = User.FindFirstValue(ClaimTypes.NameIdentifier);

            await _userService.UpdateUserAsync(user, userId);

            Log.Information("User {userId} updated user {@user}", userId, user);
            return(Ok());
        }
        public async Task ShouldUpdateUser()
        {
            UserService    userService    = new UserService(_dbContext, _userManager, _mainEventProvider, _securityService);
            UserController userController = new UserController(userService, _securityService);

            SetUser(userController, _createdUser2.Entity.Id);

            UserUpdateVm userForUpdate = new UserUpdateVm
            {
                LastName = "Svensen"
            };

            await userController.UpdateUserAsync(userForUpdate);

            ApplicationUser updatedUser = _dbContext.Users.Find(_createdUser2.Entity.Id);

            Assert.AreEqual(userForUpdate.LastName, updatedUser.LastName);
        }