Example #1
0
        public UserWithinDistanceCommandHandlerConfigurator WithUsersResultException(Exception exception)
        {
            this.userRepository
            .Setup(x => x.GetUsersAsync())
            .ReturnsAsync(GetUserResult.Failure(exception));

            return(this);
        }
Example #2
0
        public async Task <GetUserResult> GetUsersAsync()
        {
            var result = await this.userApi.GetUsersAsync();

            if (result.IsSuccess)
            {
                var mappedUsers = result
                                  .Users
                                  .Select(
                    user => new User(
                        user.Id,
                        user.FirstName,
                        user.LastName,
                        user.Email,
                        user.IpAddress,
                        new Coordinate(user.Latitude, user.Longitude)));

                return(GetUserResult.Success(mappedUsers));
            }

            return(GetUserResult.Failure(result.Exception));
        }