Beispiel #1
0
        public async Task GetUser_Should_InvokeRemoteGraphServiceGetAsync_Once()
        {
            await _remoteGraphService.GetUserAsync(_user.Id);

            _graphServiceClient.Verify(x => x.Users[_user.Id], Times.Once);
            _mockUserRequestBuilder.Verify(x => x.Request(), Times.Once);
            _mockUserRequest.Verify(x => x.GetAsync(), Times.Once);
        }
Beispiel #2
0
        public async Task <AdUser> GetUserAsync(string id)
        {
            Guard.IsValidGuidOrEmail(id);

            var user = await _remoteGraphService.GetUserAsync(id);

            if (IsActiveUser(user))
            {
                var adUser = _mapper.Map <AdUser>(user);
                return(adUser);
            }

            throw new EntityNotFoundException($"User '{id}' was not found.", id);
        }