Updated scanner to infer when it has reached the end of results.
This commit is contained in:
20
JSMR.Tests/Extensions/HttpServiceTestExtensions.cs
Normal file
20
JSMR.Tests/Extensions/HttpServiceTestExtensions.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using JSMR.Infrastructure.Http;
|
||||
using NSubstitute;
|
||||
using System.Net;
|
||||
|
||||
namespace JSMR.Tests.Extensions;
|
||||
|
||||
internal static class HttpServiceTestExtensions
|
||||
{
|
||||
public static void ReturnsContent(this IHttpService httpService, string content, HttpStatusCode statusCode = HttpStatusCode.OK)
|
||||
{
|
||||
HttpStringResponse response = new()
|
||||
{
|
||||
StatusCode = statusCode,
|
||||
Content = content
|
||||
};
|
||||
|
||||
httpService.GetAsync(Arg.Any<string>(), Arg.Any<CancellationToken>())
|
||||
.Returns(Task.FromResult(response));
|
||||
}
|
||||
}
|
||||
17
JSMR.Tests/Extensions/ScannerTestExtensions.cs
Normal file
17
JSMR.Tests/Extensions/ScannerTestExtensions.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using JSMR.Application.Scanning.Contracts;
|
||||
using JSMR.Application.Scanning.Ports;
|
||||
using Shouldly;
|
||||
|
||||
namespace JSMR.Tests.Extensions;
|
||||
|
||||
internal static class ScannerTestExtensions
|
||||
{
|
||||
public static async Task<IReadOnlyList<DLSiteWork>> ScanWorksAsync(this IVoiceWorksScanner scanner, VoiceWorkScanOptions options)
|
||||
{
|
||||
VoiceWorkScanResult result = await scanner.ScanPageAsync(options, CancellationToken.None);
|
||||
|
||||
result.EndOfResults.ShouldBeFalse();
|
||||
|
||||
return result.Works;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user