Initial implementation of voice works scanning.

This commit is contained in:
2025-09-11 00:07:49 -04:00
parent f250276a99
commit 3c0a39b324
50 changed files with 1351 additions and 88 deletions

View File

@@ -1,15 +1,13 @@
using JSMR.Application.Integrations.DLSite.Models;
using JSMR.Application.Common;
using JSMR.Application.Integrations.DLSite.Models;
using JSMR.Infrastructure.Http;
using JSMR.Infrastructure.Integrations.DLSite;
using JSMR.Infrastructure.Integrations.DLSite.Mapping;
using JSMR.Infrastructure.Integrations.DLSite.Models;
using JSMR.Infrastructure.Integrations.DLSite.Serialization;
using JSMR.Tests.Utilities;
using Microsoft.Extensions.Logging;
using NSubstitute;
using Shouldly;
using System.Net;
using System.Net.Http;
using System.Text.Json;
namespace JSMR.Tests.Integrations.DLSite;
@@ -25,26 +23,25 @@ public class DLSiteClientTests
{
string productInfoJson = await ReadJsonResourceAsync("Product-Info.json");
HttpResponseMessage response = new()
{
Content = new StringContent(productInfoJson),
StatusCode = HttpStatusCode.OK
};
IHttpService httpService = Substitute.For<IHttpService>();
HttpClient httpClient = Substitute.For<HttpClient>();
httpClient.BaseAddress = new Uri("https://fake.site.com/");
//{ BaseAddress = new Uri("https://www.dlsite.com/") };
httpClient.SendAsync(Arg.Any<HttpRequestMessage>(), Arg.Any<HttpCompletionOption>(), CancellationToken.None)
.Returns(Task.FromResult(response));
httpService.GetStringAsync(Arg.Any<string>(), CancellationToken.None)
.Returns(Task.FromResult(productInfoJson));
var logger = Substitute.For<ILogger<DLSiteClient>>();
var client = new DLSiteClient(httpClient, logger);
var client = new DLSiteClient(httpService, logger);
var result = await client.GetVoiceWorkDetailsAsync(["RJ01230163"], CancellationToken.None);
result.Count.ShouldBe(1);
result.ShouldContainKey("RJ01230163");
result["RJ01230163"].HasTrial.ShouldBeTrue();
result["RJ01230163"].HasDLPlay.ShouldBeTrue();
result["RJ01230163"].HasReviews.ShouldBeTrue();
result["RJ01230163"].SupportedLanguages.ShouldBe([Language.English]);
result["RJ01230163"].DownloadCount.ShouldBe(659);
result["RJ01230163"].WishlistCount.ShouldBe(380);
}
[Fact]