Added Chobit integration. Updated tests.
All checks were successful
ci / build-test (push) Successful in 2m27s
ci / publish-image (push) Has been skipped

This commit is contained in:
2026-03-14 21:46:53 -04:00
parent ee809e374f
commit aab7bee694
32 changed files with 521 additions and 108 deletions

View File

@@ -1,15 +1,16 @@
using JSMR.Application.Integrations.DLSite.Models;
using JSMR.Domain.Enums;
using JSMR.Domain.ValueObjects;
using JSMR.Infrastructure.Http;
using JSMR.Infrastructure.Integrations.DLSite;
using JSMR.Infrastructure.Integrations.DLSite.Mapping;
using JSMR.Infrastructure.Integrations.DLSite.Models;
using JSMR.Tests.Extensions;
using JSMR.Tests.Http;
using JSMR.Tests.Utilities;
using Microsoft.Extensions.Logging;
using NSubstitute;
using Shouldly;
using System.Net;
using System.Text;
namespace JSMR.Tests.Integrations.DLSite;
@@ -20,17 +21,33 @@ public class DLSiteClientTests
return await ResourceHelper.ReadAsync($"JSMR.Tests.Integrations.DLSite.{resourceName}");
}
private static async Task<DLSiteClient> GetDLSiteClientThatReturns(string resourceName)
{
string content = await ReadJsonResourceAsync(resourceName);
FakeHttpMessageHandler handler = new(request =>
{
return new HttpResponseMessage(HttpStatusCode.OK)
{
Content = new StringContent(content, Encoding.UTF8, "application/json")
};
});
HttpClient httpClient = new(handler)
{
BaseAddress = new Uri("https://www.fake-dlsite.com/")
};
var logger = Substitute.For<ILogger<DLSiteClient>>();
var client = new DLSiteClient(httpClient, logger);
return client;
}
[Fact]
public async Task Deserialize_Product_Info_Collection()
{
string productInfoJson = await ReadJsonResourceAsync("Product-Info.json");
IHttpService httpService = Substitute.For<IHttpService>();
httpService.ReturnsContent(productInfoJson);
var logger = Substitute.For<ILogger<DLSiteClient>>();
var client = new DLSiteClient(httpService, logger);
var client = await GetDLSiteClientThatReturns("Product-Info.json");
var result = await client.GetVoiceWorkDetailsAsync(["RJ01230163", "RJ01536422"], CancellationToken.None);
result.Count.ShouldBe(2);