Added English voice work updater.

This commit is contained in:
2025-10-23 10:07:50 -04:00
parent 3a115bc7b8
commit 36fcd5379a
19 changed files with 651 additions and 401 deletions

View File

@@ -129,24 +129,9 @@ public class VoiceWorkUpsertFixture : MariaDbFixture
public VoiceWorkIngest[] GetFirstRoundIngests()
{
DLSiteWork work1 = new()
{
ProductId = "001",
ProductName = "fdsfs",
MakerId = "RG00001",
Maker = "",
ImageUrl = "",
SmallImageUrl = ""
};
VoiceWorkDetails details1 = new()
{
AgeRating = AgeRating.R18,
};
VoiceWorkIngest[] ingests =
[
new(work1, details1)
new()
{
MakerId = "RG00001",
MakerName = "Good Dreams",
@@ -162,7 +147,7 @@ public class VoiceWorkUpsertFixture : MariaDbFixture
HasTrial = true,
HasDLPlay = true
},
new(work1, details1)
new()
{
MakerId = "RG00002",
MakerName = "Sweet Dreams",
@@ -178,7 +163,7 @@ public class VoiceWorkUpsertFixture : MariaDbFixture
HasTrial = true,
HasDLPlay = true
},
new(work1, details1)
new()
{
MakerId = "RG00003",
MakerName = "Nightmare Fuel",

View File

@@ -1,8 +1,7 @@
using JSMR.Application.Integrations.DLSite.Models;
using JSMR.Application.Scanning.Contracts;
using JSMR.Application.Scanning.Contracts;
using JSMR.Infrastructure.Common.Time;
using JSMR.Infrastructure.Data;
using JSMR.Infrastructure.Data.Repositories.VoiceWorks;
using JSMR.Infrastructure.Ingestion;
using JSMR.Tests.Fixtures;
using NSubstitute;
using Shouldly;
@@ -12,35 +11,37 @@ namespace JSMR.Tests.Integration;
public class VoiceWorkUpsertTests(VoiceWorkUpsertFixture fixture) : IClassFixture<VoiceWorkUpsertFixture>
{
[Fact]
public async Task Filter_None()
public async Task Simple_Upsert()
{
await using AppDbContext context = fixture.CreateDbContext();
ITimeProvider timeProvider = Substitute.For<ITimeProvider>();
timeProvider.Now().Returns(new DateTimeOffset(2025, 10, 1, 0, 0, 0, 0, TimeSpan.FromSeconds(0)));
DLSiteWork work1 = new()
{
ProductId = "001",
ProductName = "fdsfs",
MakerId = "RG00001",
Maker = "",
ImageUrl = "",
SmallImageUrl = ""
};
VoiceWorkDetails details1 = new()
{
AgeRating = Application.Common.AgeRating.R18,
};
VoiceWorkIngest[] ingests =
[
new(work1, details1)
new()
{
MakerId = "RG00001",
MakerName = "Good Dreams",
ProductId = "A Newly Announced Work",
Title = "",
Description = ""
},
new()
{
MakerId = "RG00001",
MakerName = "Sweet Dreams",
ProductId = "",
Title = "",
Description = ""
}
];
VoiceWorkWriter writer = new(context, timeProvider);
await writer.UpsertAsync(ingests, CancellationToken.None);
IClock clock = Substitute.For<IClock>();
clock.UtcNow.Returns(new DateTimeOffset(2025, 10, 1, 0, 0, 0, 0, TimeSpan.FromSeconds(0)));
TokyoTimeProvider timeProvider = new(clock);
VoiceWorkUpdater updater = new(context, timeProvider);
await updater.UpsertAsync(ingests, CancellationToken.None);
context.VoiceWorks.Count().ShouldBe(2);
}

View File

@@ -28,8 +28,8 @@
<PackageReference Include="NSubstitute" Version="5.3.0" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="9.0.0" />
<PackageReference Include="Shouldly" Version="4.3.0" />
<PackageReference Include="Testcontainers" Version="4.8.0" />
<PackageReference Include="Testcontainers.MariaDb" Version="4.8.0" />
<PackageReference Include="Testcontainers" Version="4.8.1" />
<PackageReference Include="Testcontainers.MariaDb" Version="4.8.1" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
<PrivateAssets>all</PrivateAssets>