Example #1
0
        private async Task <Guid> CreateInitialUserForMessages(ColidEntryContactInvalidUsersDto cec)
        {
            try
            {
                return(await _userService.GetIdByEmailAddressAsync(cec.ContactMail));
            }
            catch (EntityNotFoundException)
            {
                // in case, that the user doesn't exist within appdata service, create
                var adUser = await _activeDirectoryService.GetUserAsync(cec.ContactMail);

                var userDto = new UserDto
                {
                    Id           = new Guid(adUser.Id),
                    EmailAddress = adUser.Mail
                };
                var user = await _userService.CreateAsync(userDto);

                return(user.Id);
            }
        }
        public async Task GetUser_Should_InvokeRemoteGraphServiceGetUser_Once(string id)
        {
            await _activeDirectoryService.GetUserAsync(id);

            _mockRemoteGraphService.Verify(x => x.GetUserAsync(id), Times.Once);
        }
        public async Task <IActionResult> GetUserAsync([FromRoute] string id)
        {
            var result = await _activeDirectoryService.GetUserAsync(id);

            return(Ok(result));
        }