Added English voice work updater.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user