mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
add GetMostPopularStringAsyncShould test
This commit is contained in:
parent
f45fd6bd76
commit
c78abcc588
3 changed files with 16 additions and 2 deletions
|
|
@ -32,7 +32,7 @@ public SnapshotService(FilterListsDbContext dbContext, IConfigurationProvider ma
|
|||
public async Task CaptureAsync(int batchSize)
|
||||
{
|
||||
await CleanupFailedSnapshots();
|
||||
uaString = await UserAgentService.GetMostPopularString();
|
||||
uaString = await UserAgentService.GetMostPopularStringAsync();
|
||||
var lists = await GetListsToCapture(batchSize);
|
||||
var snaps = await CreateAndSaveSnaps<Snapshot>(lists);
|
||||
var listsToRetry = snaps.Where(s => s.WebExcepted).Select(s => s.List);
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ public static class UserAgentService
|
|||
private const string UaStringDefault =
|
||||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36";
|
||||
|
||||
public static async Task<string> GetMostPopularString()
|
||||
public static async Task<string> GetMostPopularStringAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
using Xunit;
|
||||
|
||||
namespace FilterLists.Services.Tests.UserAgent
|
||||
{
|
||||
public class GetMostPopularStringAsyncShould
|
||||
{
|
||||
[Fact]
|
||||
public async void ReturnStringContainingMozilla()
|
||||
{
|
||||
var actualString = await UserAgentService.GetMostPopularStringAsync();
|
||||
Assert.Contains("Mozilla", actualString);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue