public UserWithinDistanceCommandHandlerConfigurator WithUsersResultException(Exception exception) { this.userRepository .Setup(x => x.GetUsersAsync()) .ReturnsAsync(GetUserResult.Failure(exception)); return(this); }
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)); }