public interface ITextService
{
Task<List<string>> ReadTextAsync(List<string> sourcePath);
Task<string> HelloWorld();
}
public class TextService : ITextService
{
private readonly HttpClient _httpClient;
public TextService(HttpClient httpClient)
{
_httpClient = httpClient;
}
public async Task<List<string>> ReadTextAsync(List<string> sourcePath)
{
return await ProcessRepositoriesAsync(_httpClient, sourcePath);
}
private static async Task<List<string>> ProcessRepositoriesAsync(HttpClient client, List<string> sourcePath)
{
var listOfTexts = new List<string>();
foreach (var link in sourcePath)
{
var source = await client.GetStringAsync(link);
listOfTexts.Add(source);
}
return listOfTexts;
}
public interface ITextService
{
Task<List<string>> ReadTextAsync(List<string> sourcePath);
Task<string> HelloWorld();
}
public class TextService : ITextService
{
private readonly HttpClient _httpClient;
public TextService(HttpClient httpClient)
{
_httpClient = httpClient;
}
public async Task<List<string>> ReadTextAsync(List<string> sourcePath)
{
return await ProcessRepositoriesAsync(_httpClient, sourcePath);
}
private static async Task<List<string>> ProcessRepositoriesAsync(HttpClient client, List<string> sourcePath)
{
var listOfTexts = new List<string>();
foreach (var link in sourcePath)
{
var source = await client.GetStringAsync(link);
listOfTexts.Add(source);
}
return listOfTexts;
}