Updated integration testing for English and Japanese. Fixed minor voice work updater issue. Updated to XUnitV3.
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
using JSMR.Application.Scanning.Contracts;
|
||||
using JSMR.Application.Scanning.Ports;
|
||||
using JSMR.Infrastructure.Common.Languages;
|
||||
using JSMR.Infrastructure.Data;
|
||||
using JSMR.Infrastructure.Ingestion;
|
||||
using JSMR.Tests.Fixtures;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Shouldly;
|
||||
|
||||
namespace JSMR.Tests.Ingestion.English;
|
||||
|
||||
public class English_Fail_Attempted_Insert_When_Not_English_Tests(MariaDbContainerFixture container)
|
||||
{
|
||||
private readonly LanguageIdentifier languageIdentifier = new();
|
||||
|
||||
[Fact]
|
||||
public async Task Fail_Attempted_Insert_When_Not_English()
|
||||
{
|
||||
await using AppDbContext dbContext = await MariaTestDb.CreateIsolatedAsync(
|
||||
container.RootConnectionString,
|
||||
seed: VoiceWorkIngestionSeedData.SeedAsync);
|
||||
|
||||
VoiceWorkIngest ingest = new()
|
||||
{
|
||||
MakerId = "RG00001",
|
||||
MakerName = "Good Dreams",
|
||||
ProductId = "RJ0000001",
|
||||
Title = "すごく快適なASMR",
|
||||
Description = "最高の製品です!"
|
||||
};
|
||||
|
||||
EnglishVoiceWorkUpdater updater = new(dbContext, languageIdentifier);
|
||||
VoiceWorkUpsertResult[] results = await updater.UpsertAsync([ingest], CancellationToken.None);
|
||||
|
||||
int englishVoiceWorkCount = await dbContext.EnglishVoiceWorks.CountAsync(CancellationToken.None);
|
||||
englishVoiceWorkCount.ShouldBe(0);
|
||||
|
||||
results.Length.ShouldBe(1);
|
||||
results.Count(r => r.Status == VoiceWorkUpsertStatus.Inserted).ShouldBe(0);
|
||||
results.Count(r => r.Status == VoiceWorkUpsertStatus.Updated).ShouldBe(0);
|
||||
results.Count(r => r.Status == VoiceWorkUpsertStatus.Skipped).ShouldBe(1);
|
||||
results.Sum(r => r.Issues.Count).ShouldBe(1);
|
||||
|
||||
VoiceWorkUpsertIssue issue = results[0].Issues.ElementAt(0);
|
||||
issue.Severity.ShouldBe(VoiceWorkUpsertIssueSeverity.Information);
|
||||
issue.Message.ShouldBe("Product title and/or description is not in English");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
using JSMR.Application.Scanning.Contracts;
|
||||
using JSMR.Application.Scanning.Ports;
|
||||
using JSMR.Infrastructure.Common.Languages;
|
||||
using JSMR.Infrastructure.Data;
|
||||
using JSMR.Infrastructure.Ingestion;
|
||||
using JSMR.Tests.Fixtures;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Shouldly;
|
||||
|
||||
namespace JSMR.Tests.Ingestion.English;
|
||||
|
||||
public class English_Fail_Attempted_Insert_With_Missing_Circle_Tests(MariaDbContainerFixture container) //: IAssemblyFixture<MariaDbContainerFixture>
|
||||
{
|
||||
private readonly LanguageIdentifier languageIdentifier = new();
|
||||
|
||||
[Fact]
|
||||
public async Task Fail_Attempted_Insert_With_Missing_Circle()
|
||||
{
|
||||
await using AppDbContext dbContext = await MariaTestDb.CreateIsolatedAsync(
|
||||
container.RootConnectionString,
|
||||
seed: VoiceWorkIngestionSeedData.SeedAsync);
|
||||
|
||||
VoiceWorkIngest ingest = new()
|
||||
{
|
||||
MakerId = "RG99999",
|
||||
MakerName = "Missing Maker",
|
||||
ProductId = "RJ9999999",
|
||||
Title = "EN Title",
|
||||
Description = "EN Desc"
|
||||
};
|
||||
|
||||
EnglishVoiceWorkUpdater updater = new(dbContext, languageIdentifier);
|
||||
VoiceWorkUpsertResult[] results = await updater.UpsertAsync([ingest], CancellationToken.None);
|
||||
|
||||
int englishVoiceWorkCount = await dbContext.EnglishVoiceWorks.CountAsync(CancellationToken.None);
|
||||
englishVoiceWorkCount.ShouldBe(0);
|
||||
|
||||
results.Length.ShouldBe(1);
|
||||
results.Count(r => r.Status == VoiceWorkUpsertStatus.Inserted).ShouldBe(0);
|
||||
results.Count(r => r.Status == VoiceWorkUpsertStatus.Updated).ShouldBe(0);
|
||||
results.Count(r => r.Status == VoiceWorkUpsertStatus.Skipped).ShouldBe(1);
|
||||
results.Sum(r => r.Issues.Count).ShouldBe(1);
|
||||
|
||||
VoiceWorkUpsertIssue issue = results[0].Issues.ElementAt(0);
|
||||
issue.Severity.ShouldBe(VoiceWorkUpsertIssueSeverity.Error);
|
||||
issue.Message.ShouldBe($"Unable to find circle for maker id: {ingest.MakerId}");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
using JSMR.Application.Scanning.Contracts;
|
||||
using JSMR.Application.Scanning.Ports;
|
||||
using JSMR.Infrastructure.Common.Languages;
|
||||
using JSMR.Infrastructure.Data;
|
||||
using JSMR.Infrastructure.Ingestion;
|
||||
using JSMR.Tests.Fixtures;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Shouldly;
|
||||
|
||||
namespace JSMR.Tests.Ingestion.English;
|
||||
|
||||
public class English_Fail_Attempted_Insert_With_Missing_Product_Tests(MariaDbContainerFixture container)
|
||||
{
|
||||
private readonly LanguageIdentifier languageIdentifier = new();
|
||||
|
||||
[Fact]
|
||||
public async Task Fail_Attempted_Insert_With_Missing_Product()
|
||||
{
|
||||
await using AppDbContext dbContext = await MariaTestDb.CreateIsolatedAsync(
|
||||
container.RootConnectionString,
|
||||
seed: VoiceWorkIngestionSeedData.SeedAsync);
|
||||
|
||||
VoiceWorkIngest ingest = new()
|
||||
{
|
||||
MakerId = "RG00001",
|
||||
MakerName = "Good Dreams",
|
||||
ProductId = "RJ9999999",
|
||||
Title = "EN Title",
|
||||
Description = "EN Desc"
|
||||
};
|
||||
|
||||
EnglishVoiceWorkUpdater updater = new(dbContext, languageIdentifier);
|
||||
VoiceWorkUpsertResult[] results = await updater.UpsertAsync([ingest], CancellationToken.None);
|
||||
|
||||
int englishVoiceWorkCount = await dbContext.EnglishVoiceWorks.CountAsync(CancellationToken.None);
|
||||
englishVoiceWorkCount.ShouldBe(0);
|
||||
|
||||
results.Length.ShouldBe(1);
|
||||
results.Count(r => r.Status == VoiceWorkUpsertStatus.Inserted).ShouldBe(0);
|
||||
results.Count(r => r.Status == VoiceWorkUpsertStatus.Updated).ShouldBe(0);
|
||||
results.Count(r => r.Status == VoiceWorkUpsertStatus.Skipped).ShouldBe(1);
|
||||
results.Sum(r => r.Issues.Count).ShouldBe(1);
|
||||
|
||||
VoiceWorkUpsertIssue issue = results[0].Issues.ElementAt(0);
|
||||
issue.Severity.ShouldBe(VoiceWorkUpsertIssueSeverity.Error);
|
||||
issue.Message.ShouldBe($"Unable to find voice work for product id: {ingest.ProductId}");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
using JSMR.Application.Scanning.Contracts;
|
||||
using JSMR.Application.Scanning.Ports;
|
||||
using JSMR.Domain.Entities;
|
||||
using JSMR.Infrastructure.Common.Languages;
|
||||
using JSMR.Infrastructure.Data;
|
||||
using JSMR.Infrastructure.Ingestion;
|
||||
using JSMR.Tests.Fixtures;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Shouldly;
|
||||
|
||||
namespace JSMR.Tests.Ingestion.English;
|
||||
|
||||
public class English_Insert_Then_Update_Tests(MariaDbContainerFixture container) //: IAssemblyFixture<MariaDbContainerFixture>
|
||||
{
|
||||
private readonly LanguageIdentifier languageIdentifier = new();
|
||||
|
||||
[Fact]
|
||||
public async Task Insert_Then_Update()
|
||||
{
|
||||
await using AppDbContext dbContext = await MariaTestDb.CreateIsolatedAsync(
|
||||
container.RootConnectionString,
|
||||
seed: VoiceWorkIngestionSeedData.SeedAsync);
|
||||
|
||||
// Part 1 -- Insert
|
||||
VoiceWorkIngest ingest = new()
|
||||
{
|
||||
MakerId = "RG00001",
|
||||
MakerName = "Good Dreams",
|
||||
ProductId = "RJ0000001",
|
||||
Title = "Today Sounds (EN)",
|
||||
Description = "An average product. (EN)"
|
||||
};
|
||||
|
||||
EnglishVoiceWorkUpdater updater = new(dbContext, languageIdentifier);
|
||||
VoiceWorkUpsertResult[] results = await updater.UpsertAsync([ingest], TestContext.Current.CancellationToken);
|
||||
|
||||
VoiceWork voiceWork = await dbContext.VoiceWorks.SingleAsync(v => v.ProductId == "RJ0000001", TestContext.Current.CancellationToken);
|
||||
EnglishVoiceWork? englishVoiceWork = await dbContext.EnglishVoiceWorks.SingleOrDefaultAsync(e => e.VoiceWorkId == voiceWork.VoiceWorkId, TestContext.Current.CancellationToken);
|
||||
|
||||
englishVoiceWork.ShouldNotBeNull();
|
||||
englishVoiceWork.ProductName.ShouldBe("Today Sounds (EN)");
|
||||
englishVoiceWork.Description.ShouldBe("An average product. (EN)");
|
||||
englishVoiceWork.IsValid?.ShouldBeTrue();
|
||||
|
||||
results.Length.ShouldBe(1);
|
||||
results.Count(r => r.Status == VoiceWorkUpsertStatus.Inserted).ShouldBe(1);
|
||||
results.Count(r => r.Status == VoiceWorkUpsertStatus.Updated).ShouldBe(0);
|
||||
results.Count(r => r.Status == VoiceWorkUpsertStatus.Skipped).ShouldBe(0);
|
||||
results.Count(r => r.Status == VoiceWorkUpsertStatus.Unchanged).ShouldBe(0);
|
||||
results.Sum(r => r.Issues.Count).ShouldBe(0);
|
||||
|
||||
// Part 2 -- Update
|
||||
VoiceWorkIngest ingestUpdate = ingest with
|
||||
{
|
||||
Title = "Today Sounds (EN v2)",
|
||||
Description = "Updated English description."
|
||||
};
|
||||
|
||||
VoiceWorkUpsertResult[] updatedResults = await updater.UpsertAsync([ingestUpdate], CancellationToken.None);
|
||||
|
||||
EnglishVoiceWork? updatedEnglishVoiceWork = await dbContext.EnglishVoiceWorks.SingleOrDefaultAsync(e => e.VoiceWorkId == voiceWork.VoiceWorkId, TestContext.Current.CancellationToken);
|
||||
updatedEnglishVoiceWork.ShouldNotBeNull();
|
||||
updatedEnglishVoiceWork.ProductName.ShouldBe("Today Sounds (EN v2)");
|
||||
updatedEnglishVoiceWork.Description.ShouldBe("Updated English description.");
|
||||
updatedEnglishVoiceWork.IsValid?.ShouldBeTrue();
|
||||
|
||||
updatedResults.Length.ShouldBe(1);
|
||||
updatedResults.Count(r => r.Status == VoiceWorkUpsertStatus.Inserted).ShouldBe(0);
|
||||
updatedResults.Count(r => r.Status == VoiceWorkUpsertStatus.Updated).ShouldBe(1);
|
||||
updatedResults.Count(r => r.Status == VoiceWorkUpsertStatus.Skipped).ShouldBe(0);
|
||||
updatedResults.Count(r => r.Status == VoiceWorkUpsertStatus.Unchanged).ShouldBe(0);
|
||||
updatedResults.Sum(r => r.Issues.Count).ShouldBe(0);
|
||||
|
||||
// Part 3 -- Update Again (No Change)
|
||||
VoiceWorkUpsertResult[] updatedAgainResults = await updater.UpsertAsync([ingestUpdate], CancellationToken.None);
|
||||
|
||||
EnglishVoiceWork? updatedAgainEnglishVoiceWork = await dbContext.EnglishVoiceWorks.SingleOrDefaultAsync(e => e.VoiceWorkId == voiceWork.VoiceWorkId, TestContext.Current.CancellationToken);
|
||||
updatedAgainEnglishVoiceWork.ShouldNotBeNull();
|
||||
updatedAgainEnglishVoiceWork.ProductName.ShouldBe("Today Sounds (EN v2)");
|
||||
updatedAgainEnglishVoiceWork.Description.ShouldBe("Updated English description.");
|
||||
updatedAgainEnglishVoiceWork.IsValid?.ShouldBeTrue();
|
||||
|
||||
updatedAgainResults.Length.ShouldBe(1);
|
||||
updatedAgainResults.Count(r => r.Status == VoiceWorkUpsertStatus.Inserted).ShouldBe(0);
|
||||
updatedAgainResults.Count(r => r.Status == VoiceWorkUpsertStatus.Updated).ShouldBe(0);
|
||||
updatedAgainResults.Count(r => r.Status == VoiceWorkUpsertStatus.Skipped).ShouldBe(0);
|
||||
updatedAgainResults.Count(r => r.Status == VoiceWorkUpsertStatus.Unchanged).ShouldBe(1);
|
||||
updatedAgainResults.Sum(r => r.Issues.Count).ShouldBe(0);
|
||||
}
|
||||
}
|
||||
@@ -1,189 +1,189 @@
|
||||
using JSMR.Application.Scanning.Contracts;
|
||||
using JSMR.Application.Scanning.Ports;
|
||||
using JSMR.Domain.Entities;
|
||||
using JSMR.Infrastructure.Common.Languages;
|
||||
using JSMR.Infrastructure.Data;
|
||||
using JSMR.Infrastructure.Ingestion;
|
||||
using JSMR.Tests.Fixtures;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Shouldly;
|
||||
//using JSMR.Application.Scanning.Contracts;
|
||||
//using JSMR.Application.Scanning.Ports;
|
||||
//using JSMR.Domain.Entities;
|
||||
//using JSMR.Infrastructure.Common.Languages;
|
||||
//using JSMR.Infrastructure.Data;
|
||||
//using JSMR.Infrastructure.Ingestion;
|
||||
//using JSMR.Tests.Fixtures;
|
||||
//using Microsoft.EntityFrameworkCore;
|
||||
//using Shouldly;
|
||||
|
||||
namespace JSMR.Tests.Ingestion;
|
||||
//namespace JSMR.Tests.Ingestion;
|
||||
|
||||
public class EnglishLocalizationTests(MariaDbContainerFixture container) : IClassFixture<MariaDbContainerFixture>
|
||||
{
|
||||
private readonly LanguageIdentifier languageIdentifier = new();
|
||||
//public class EnglishLocalizationTests(MariaDbContainerFixture container) //: IClassFixture<MariaDbContainerFixture>
|
||||
//{
|
||||
// private readonly LanguageIdentifier languageIdentifier = new();
|
||||
|
||||
[Fact]
|
||||
public async Task Insert_Then_Update()
|
||||
{
|
||||
await using AppDbContext dbContext = await MariaTestDb.CreateIsolatedAsync(
|
||||
container.RootConnectionString,
|
||||
seed: VoiceWorkIngestionSeedData.SeedAsync);
|
||||
// [Fact]
|
||||
// public async Task Insert_Then_Update()
|
||||
// {
|
||||
// await using AppDbContext dbContext = await MariaTestDb.CreateIsolatedAsync(
|
||||
// container.RootConnectionString,
|
||||
// seed: VoiceWorkIngestionSeedData.SeedAsync);
|
||||
|
||||
// Part 1 -- Insert
|
||||
VoiceWorkIngest ingest = new()
|
||||
{
|
||||
MakerId = "RG00001",
|
||||
MakerName = "Good Dreams",
|
||||
ProductId = "RJ0000001",
|
||||
Title = "Today Sounds (EN)",
|
||||
Description = "An average product. (EN)"
|
||||
};
|
||||
// // Part 1 -- Insert
|
||||
// VoiceWorkIngest ingest = new()
|
||||
// {
|
||||
// MakerId = "RG00001",
|
||||
// MakerName = "Good Dreams",
|
||||
// ProductId = "RJ0000001",
|
||||
// Title = "Today Sounds (EN)",
|
||||
// Description = "An average product. (EN)"
|
||||
// };
|
||||
|
||||
EnglishVoiceWorkUpdater updater = new(dbContext, languageIdentifier);
|
||||
VoiceWorkUpsertResult[] results = await updater.UpsertAsync([ingest], CancellationToken.None);
|
||||
// EnglishVoiceWorkUpdater updater = new(dbContext, languageIdentifier);
|
||||
// VoiceWorkUpsertResult[] results = await updater.UpsertAsync([ingest], CancellationToken.None);
|
||||
|
||||
VoiceWork voiceWork = await dbContext.VoiceWorks.SingleAsync(v => v.ProductId == "RJ0000001");
|
||||
EnglishVoiceWork? englishVoiceWork = await dbContext.EnglishVoiceWorks.SingleOrDefaultAsync(e => e.VoiceWorkId == voiceWork.VoiceWorkId);
|
||||
// VoiceWork voiceWork = await dbContext.VoiceWorks.SingleAsync(v => v.ProductId == "RJ0000001");
|
||||
// EnglishVoiceWork? englishVoiceWork = await dbContext.EnglishVoiceWorks.SingleOrDefaultAsync(e => e.VoiceWorkId == voiceWork.VoiceWorkId);
|
||||
|
||||
englishVoiceWork.ShouldNotBeNull();
|
||||
englishVoiceWork.ProductName.ShouldBe("Today Sounds (EN)");
|
||||
englishVoiceWork.Description.ShouldBe("An average product. (EN)");
|
||||
englishVoiceWork.IsValid?.ShouldBeTrue();
|
||||
// englishVoiceWork.ShouldNotBeNull();
|
||||
// englishVoiceWork.ProductName.ShouldBe("Today Sounds (EN)");
|
||||
// englishVoiceWork.Description.ShouldBe("An average product. (EN)");
|
||||
// englishVoiceWork.IsValid?.ShouldBeTrue();
|
||||
|
||||
results.Length.ShouldBe(1);
|
||||
results.Count(r => r.Status == VoiceWorkUpsertStatus.Inserted).ShouldBe(1);
|
||||
results.Count(r => r.Status == VoiceWorkUpsertStatus.Updated).ShouldBe(0);
|
||||
results.Count(r => r.Status == VoiceWorkUpsertStatus.Skipped).ShouldBe(0);
|
||||
results.Count(r => r.Status == VoiceWorkUpsertStatus.Unchanged).ShouldBe(0);
|
||||
results.Sum(r => r.Issues.Count).ShouldBe(0);
|
||||
// results.Length.ShouldBe(1);
|
||||
// results.Count(r => r.Status == VoiceWorkUpsertStatus.Inserted).ShouldBe(1);
|
||||
// results.Count(r => r.Status == VoiceWorkUpsertStatus.Updated).ShouldBe(0);
|
||||
// results.Count(r => r.Status == VoiceWorkUpsertStatus.Skipped).ShouldBe(0);
|
||||
// results.Count(r => r.Status == VoiceWorkUpsertStatus.Unchanged).ShouldBe(0);
|
||||
// results.Sum(r => r.Issues.Count).ShouldBe(0);
|
||||
|
||||
// Part 2 -- Update
|
||||
VoiceWorkIngest ingestUpdate = ingest with
|
||||
{
|
||||
Title = "Today Sounds (EN v2)",
|
||||
Description = "Updated English description."
|
||||
};
|
||||
// // Part 2 -- Update
|
||||
// VoiceWorkIngest ingestUpdate = ingest with
|
||||
// {
|
||||
// Title = "Today Sounds (EN v2)",
|
||||
// Description = "Updated English description."
|
||||
// };
|
||||
|
||||
VoiceWorkUpsertResult[] updatedResults = await updater.UpsertAsync([ingestUpdate], CancellationToken.None);
|
||||
// VoiceWorkUpsertResult[] updatedResults = await updater.UpsertAsync([ingestUpdate], CancellationToken.None);
|
||||
|
||||
EnglishVoiceWork? updatedEnglishVoiceWork = await dbContext.EnglishVoiceWorks.SingleOrDefaultAsync(e => e.VoiceWorkId == voiceWork.VoiceWorkId);
|
||||
updatedEnglishVoiceWork.ShouldNotBeNull();
|
||||
updatedEnglishVoiceWork.ProductName.ShouldBe("Today Sounds (EN v2)");
|
||||
updatedEnglishVoiceWork.Description.ShouldBe("Updated English description.");
|
||||
updatedEnglishVoiceWork.IsValid?.ShouldBeTrue();
|
||||
// EnglishVoiceWork? updatedEnglishVoiceWork = await dbContext.EnglishVoiceWorks.SingleOrDefaultAsync(e => e.VoiceWorkId == voiceWork.VoiceWorkId);
|
||||
// updatedEnglishVoiceWork.ShouldNotBeNull();
|
||||
// updatedEnglishVoiceWork.ProductName.ShouldBe("Today Sounds (EN v2)");
|
||||
// updatedEnglishVoiceWork.Description.ShouldBe("Updated English description.");
|
||||
// updatedEnglishVoiceWork.IsValid?.ShouldBeTrue();
|
||||
|
||||
updatedResults.Length.ShouldBe(1);
|
||||
updatedResults.Count(r => r.Status == VoiceWorkUpsertStatus.Inserted).ShouldBe(0);
|
||||
updatedResults.Count(r => r.Status == VoiceWorkUpsertStatus.Updated).ShouldBe(1);
|
||||
updatedResults.Count(r => r.Status == VoiceWorkUpsertStatus.Skipped).ShouldBe(0);
|
||||
updatedResults.Count(r => r.Status == VoiceWorkUpsertStatus.Unchanged).ShouldBe(0);
|
||||
updatedResults.Sum(r => r.Issues.Count).ShouldBe(0);
|
||||
// updatedResults.Length.ShouldBe(1);
|
||||
// updatedResults.Count(r => r.Status == VoiceWorkUpsertStatus.Inserted).ShouldBe(0);
|
||||
// updatedResults.Count(r => r.Status == VoiceWorkUpsertStatus.Updated).ShouldBe(1);
|
||||
// updatedResults.Count(r => r.Status == VoiceWorkUpsertStatus.Skipped).ShouldBe(0);
|
||||
// updatedResults.Count(r => r.Status == VoiceWorkUpsertStatus.Unchanged).ShouldBe(0);
|
||||
// updatedResults.Sum(r => r.Issues.Count).ShouldBe(0);
|
||||
|
||||
// Part 3 -- Update Again (No Change)
|
||||
VoiceWorkUpsertResult[] updatedAgainResults = await updater.UpsertAsync([ingestUpdate], CancellationToken.None);
|
||||
// // Part 3 -- Update Again (No Change)
|
||||
// VoiceWorkUpsertResult[] updatedAgainResults = await updater.UpsertAsync([ingestUpdate], CancellationToken.None);
|
||||
|
||||
EnglishVoiceWork? updatedAgainEnglishVoiceWork = await dbContext.EnglishVoiceWorks.SingleOrDefaultAsync(e => e.VoiceWorkId == voiceWork.VoiceWorkId);
|
||||
updatedAgainEnglishVoiceWork.ShouldNotBeNull();
|
||||
updatedAgainEnglishVoiceWork.ProductName.ShouldBe("Today Sounds (EN v2)");
|
||||
updatedAgainEnglishVoiceWork.Description.ShouldBe("Updated English description.");
|
||||
updatedAgainEnglishVoiceWork.IsValid?.ShouldBeTrue();
|
||||
// EnglishVoiceWork? updatedAgainEnglishVoiceWork = await dbContext.EnglishVoiceWorks.SingleOrDefaultAsync(e => e.VoiceWorkId == voiceWork.VoiceWorkId);
|
||||
// updatedAgainEnglishVoiceWork.ShouldNotBeNull();
|
||||
// updatedAgainEnglishVoiceWork.ProductName.ShouldBe("Today Sounds (EN v2)");
|
||||
// updatedAgainEnglishVoiceWork.Description.ShouldBe("Updated English description.");
|
||||
// updatedAgainEnglishVoiceWork.IsValid?.ShouldBeTrue();
|
||||
|
||||
updatedAgainResults.Length.ShouldBe(1);
|
||||
updatedAgainResults.Count(r => r.Status == VoiceWorkUpsertStatus.Inserted).ShouldBe(0);
|
||||
updatedAgainResults.Count(r => r.Status == VoiceWorkUpsertStatus.Updated).ShouldBe(0);
|
||||
updatedAgainResults.Count(r => r.Status == VoiceWorkUpsertStatus.Skipped).ShouldBe(0);
|
||||
updatedAgainResults.Count(r => r.Status == VoiceWorkUpsertStatus.Unchanged).ShouldBe(1);
|
||||
updatedAgainResults.Sum(r => r.Issues.Count).ShouldBe(0);
|
||||
}
|
||||
// updatedAgainResults.Length.ShouldBe(1);
|
||||
// updatedAgainResults.Count(r => r.Status == VoiceWorkUpsertStatus.Inserted).ShouldBe(0);
|
||||
// updatedAgainResults.Count(r => r.Status == VoiceWorkUpsertStatus.Updated).ShouldBe(0);
|
||||
// updatedAgainResults.Count(r => r.Status == VoiceWorkUpsertStatus.Skipped).ShouldBe(0);
|
||||
// updatedAgainResults.Count(r => r.Status == VoiceWorkUpsertStatus.Unchanged).ShouldBe(1);
|
||||
// updatedAgainResults.Sum(r => r.Issues.Count).ShouldBe(0);
|
||||
// }
|
||||
|
||||
[Fact]
|
||||
public async Task Fail_Attempted_Insert_With_Missing_Circle()
|
||||
{
|
||||
await using AppDbContext dbContext = await MariaTestDb.CreateIsolatedAsync(
|
||||
container.RootConnectionString,
|
||||
seed: VoiceWorkIngestionSeedData.SeedAsync);
|
||||
// [Fact]
|
||||
// public async Task Fail_Attempted_Insert_With_Missing_Circle()
|
||||
// {
|
||||
// await using AppDbContext dbContext = await MariaTestDb.CreateIsolatedAsync(
|
||||
// container.RootConnectionString,
|
||||
// seed: VoiceWorkIngestionSeedData.SeedAsync);
|
||||
|
||||
VoiceWorkIngest ingest = new()
|
||||
{
|
||||
MakerId = "RG99999",
|
||||
MakerName = "Missing Maker",
|
||||
ProductId = "RJ9999999",
|
||||
Title = "EN Title",
|
||||
Description = "EN Desc"
|
||||
};
|
||||
// VoiceWorkIngest ingest = new()
|
||||
// {
|
||||
// MakerId = "RG99999",
|
||||
// MakerName = "Missing Maker",
|
||||
// ProductId = "RJ9999999",
|
||||
// Title = "EN Title",
|
||||
// Description = "EN Desc"
|
||||
// };
|
||||
|
||||
EnglishVoiceWorkUpdater updater = new(dbContext, languageIdentifier);
|
||||
VoiceWorkUpsertResult[] results = await updater.UpsertAsync([ingest], CancellationToken.None);
|
||||
// EnglishVoiceWorkUpdater updater = new(dbContext, languageIdentifier);
|
||||
// VoiceWorkUpsertResult[] results = await updater.UpsertAsync([ingest], CancellationToken.None);
|
||||
|
||||
int englishVoiceWorkCount = await dbContext.EnglishVoiceWorks.CountAsync(CancellationToken.None);
|
||||
englishVoiceWorkCount.ShouldBe(0);
|
||||
// int englishVoiceWorkCount = await dbContext.EnglishVoiceWorks.CountAsync(CancellationToken.None);
|
||||
// englishVoiceWorkCount.ShouldBe(0);
|
||||
|
||||
results.Length.ShouldBe(1);
|
||||
results.Count(r => r.Status == VoiceWorkUpsertStatus.Inserted).ShouldBe(0);
|
||||
results.Count(r => r.Status == VoiceWorkUpsertStatus.Updated).ShouldBe(0);
|
||||
results.Count(r => r.Status == VoiceWorkUpsertStatus.Skipped).ShouldBe(1);
|
||||
results.Sum(r => r.Issues.Count).ShouldBe(1);
|
||||
// results.Length.ShouldBe(1);
|
||||
// results.Count(r => r.Status == VoiceWorkUpsertStatus.Inserted).ShouldBe(0);
|
||||
// results.Count(r => r.Status == VoiceWorkUpsertStatus.Updated).ShouldBe(0);
|
||||
// results.Count(r => r.Status == VoiceWorkUpsertStatus.Skipped).ShouldBe(1);
|
||||
// results.Sum(r => r.Issues.Count).ShouldBe(1);
|
||||
|
||||
VoiceWorkUpsertIssue issue = results[0].Issues.ElementAt(0);
|
||||
issue.Severity.ShouldBe(VoiceWorkUpsertIssueSeverity.Error);
|
||||
issue.Message.ShouldBe($"Unable to find circle for maker id: {ingest.MakerId}");
|
||||
}
|
||||
// VoiceWorkUpsertIssue issue = results[0].Issues.ElementAt(0);
|
||||
// issue.Severity.ShouldBe(VoiceWorkUpsertIssueSeverity.Error);
|
||||
// issue.Message.ShouldBe($"Unable to find circle for maker id: {ingest.MakerId}");
|
||||
// }
|
||||
|
||||
[Fact]
|
||||
public async Task Fail_Attempted_Insert_With_Missing_Product()
|
||||
{
|
||||
await using AppDbContext dbContext = await MariaTestDb.CreateIsolatedAsync(
|
||||
container.RootConnectionString,
|
||||
seed: VoiceWorkIngestionSeedData.SeedAsync);
|
||||
// [Fact]
|
||||
// public async Task Fail_Attempted_Insert_With_Missing_Product()
|
||||
// {
|
||||
// await using AppDbContext dbContext = await MariaTestDb.CreateIsolatedAsync(
|
||||
// container.RootConnectionString,
|
||||
// seed: VoiceWorkIngestionSeedData.SeedAsync);
|
||||
|
||||
VoiceWorkIngest ingest = new()
|
||||
{
|
||||
MakerId = "RG00001",
|
||||
MakerName = "Good Dreams",
|
||||
ProductId = "RJ9999999",
|
||||
Title = "EN Title",
|
||||
Description = "EN Desc"
|
||||
};
|
||||
// VoiceWorkIngest ingest = new()
|
||||
// {
|
||||
// MakerId = "RG00001",
|
||||
// MakerName = "Good Dreams",
|
||||
// ProductId = "RJ9999999",
|
||||
// Title = "EN Title",
|
||||
// Description = "EN Desc"
|
||||
// };
|
||||
|
||||
EnglishVoiceWorkUpdater updater = new(dbContext, languageIdentifier);
|
||||
VoiceWorkUpsertResult[] results = await updater.UpsertAsync([ingest], CancellationToken.None);
|
||||
// EnglishVoiceWorkUpdater updater = new(dbContext, languageIdentifier);
|
||||
// VoiceWorkUpsertResult[] results = await updater.UpsertAsync([ingest], CancellationToken.None);
|
||||
|
||||
int englishVoiceWorkCount = await dbContext.EnglishVoiceWorks.CountAsync(CancellationToken.None);
|
||||
englishVoiceWorkCount.ShouldBe(0);
|
||||
// int englishVoiceWorkCount = await dbContext.EnglishVoiceWorks.CountAsync(CancellationToken.None);
|
||||
// englishVoiceWorkCount.ShouldBe(0);
|
||||
|
||||
results.Length.ShouldBe(1);
|
||||
results.Count(r => r.Status == VoiceWorkUpsertStatus.Inserted).ShouldBe(0);
|
||||
results.Count(r => r.Status == VoiceWorkUpsertStatus.Updated).ShouldBe(0);
|
||||
results.Count(r => r.Status == VoiceWorkUpsertStatus.Skipped).ShouldBe(1);
|
||||
results.Sum(r => r.Issues.Count).ShouldBe(1);
|
||||
// results.Length.ShouldBe(1);
|
||||
// results.Count(r => r.Status == VoiceWorkUpsertStatus.Inserted).ShouldBe(0);
|
||||
// results.Count(r => r.Status == VoiceWorkUpsertStatus.Updated).ShouldBe(0);
|
||||
// results.Count(r => r.Status == VoiceWorkUpsertStatus.Skipped).ShouldBe(1);
|
||||
// results.Sum(r => r.Issues.Count).ShouldBe(1);
|
||||
|
||||
VoiceWorkUpsertIssue issue = results[0].Issues.ElementAt(0);
|
||||
issue.Severity.ShouldBe(VoiceWorkUpsertIssueSeverity.Error);
|
||||
issue.Message.ShouldBe($"Unable to find voice work for product id: {ingest.ProductId}");
|
||||
}
|
||||
// VoiceWorkUpsertIssue issue = results[0].Issues.ElementAt(0);
|
||||
// issue.Severity.ShouldBe(VoiceWorkUpsertIssueSeverity.Error);
|
||||
// issue.Message.ShouldBe($"Unable to find voice work for product id: {ingest.ProductId}");
|
||||
// }
|
||||
|
||||
[Fact]
|
||||
public async Task Fail_Attempted_Insert_When_Not_English()
|
||||
{
|
||||
await using AppDbContext dbContext = await MariaTestDb.CreateIsolatedAsync(
|
||||
container.RootConnectionString,
|
||||
seed: VoiceWorkIngestionSeedData.SeedAsync);
|
||||
// [Fact]
|
||||
// public async Task Fail_Attempted_Insert_When_Not_English()
|
||||
// {
|
||||
// await using AppDbContext dbContext = await MariaTestDb.CreateIsolatedAsync(
|
||||
// container.RootConnectionString,
|
||||
// seed: VoiceWorkIngestionSeedData.SeedAsync);
|
||||
|
||||
VoiceWorkIngest ingest = new()
|
||||
{
|
||||
MakerId = "RG00001",
|
||||
MakerName = "Good Dreams",
|
||||
ProductId = "RJ0000001",
|
||||
Title = "すごく快適なASMR",
|
||||
Description = "最高の製品です!"
|
||||
};
|
||||
// VoiceWorkIngest ingest = new()
|
||||
// {
|
||||
// MakerId = "RG00001",
|
||||
// MakerName = "Good Dreams",
|
||||
// ProductId = "RJ0000001",
|
||||
// Title = "すごく快適なASMR",
|
||||
// Description = "最高の製品です!"
|
||||
// };
|
||||
|
||||
EnglishVoiceWorkUpdater updater = new(dbContext, languageIdentifier);
|
||||
VoiceWorkUpsertResult[] results = await updater.UpsertAsync([ingest], CancellationToken.None);
|
||||
// EnglishVoiceWorkUpdater updater = new(dbContext, languageIdentifier);
|
||||
// VoiceWorkUpsertResult[] results = await updater.UpsertAsync([ingest], CancellationToken.None);
|
||||
|
||||
int englishVoiceWorkCount = await dbContext.EnglishVoiceWorks.CountAsync(CancellationToken.None);
|
||||
englishVoiceWorkCount.ShouldBe(0);
|
||||
// int englishVoiceWorkCount = await dbContext.EnglishVoiceWorks.CountAsync(CancellationToken.None);
|
||||
// englishVoiceWorkCount.ShouldBe(0);
|
||||
|
||||
results.Length.ShouldBe(1);
|
||||
results.Count(r => r.Status == VoiceWorkUpsertStatus.Inserted).ShouldBe(0);
|
||||
results.Count(r => r.Status == VoiceWorkUpsertStatus.Updated).ShouldBe(0);
|
||||
results.Count(r => r.Status == VoiceWorkUpsertStatus.Skipped).ShouldBe(1);
|
||||
results.Sum(r => r.Issues.Count).ShouldBe(1);
|
||||
// results.Length.ShouldBe(1);
|
||||
// results.Count(r => r.Status == VoiceWorkUpsertStatus.Inserted).ShouldBe(0);
|
||||
// results.Count(r => r.Status == VoiceWorkUpsertStatus.Updated).ShouldBe(0);
|
||||
// results.Count(r => r.Status == VoiceWorkUpsertStatus.Skipped).ShouldBe(1);
|
||||
// results.Sum(r => r.Issues.Count).ShouldBe(1);
|
||||
|
||||
VoiceWorkUpsertIssue issue = results[0].Issues.ElementAt(0);
|
||||
issue.Severity.ShouldBe(VoiceWorkUpsertIssueSeverity.Information);
|
||||
issue.Message.ShouldBe("Product title and/or description is not in English");
|
||||
}
|
||||
}
|
||||
// VoiceWorkUpsertIssue issue = results[0].Issues.ElementAt(0);
|
||||
// issue.Severity.ShouldBe(VoiceWorkUpsertIssueSeverity.Information);
|
||||
// issue.Message.ShouldBe("Product title and/or description is not in English");
|
||||
// }
|
||||
//}
|
||||
31
JSMR.Tests/Ingestion/Japanese/IngestionTestsBase.cs
Normal file
31
JSMR.Tests/Ingestion/Japanese/IngestionTestsBase.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using JSMR.Application.Scanning.Contracts;
|
||||
using JSMR.Application.Scanning.Ports;
|
||||
using JSMR.Infrastructure.Common.Time;
|
||||
using JSMR.Infrastructure.Data;
|
||||
using JSMR.Infrastructure.Ingestion;
|
||||
using JSMR.Tests.Fixtures;
|
||||
using NSubstitute;
|
||||
|
||||
namespace JSMR.Tests.Ingestion.Japanese;
|
||||
|
||||
public abstract class IngestionTestsBase(MariaDbContainerFixture container)
|
||||
{
|
||||
protected async Task<AppDbContext> GetAppDbContextAsync()
|
||||
{
|
||||
return await MariaTestDb.CreateIsolatedAsync(
|
||||
container.RootConnectionString,
|
||||
seed: VoiceWorkIngestionSeedData.SeedAsync);
|
||||
}
|
||||
|
||||
protected static async Task<VoiceWorkUpsertResult[]> UpsertAsync(AppDbContext dbContext, DateTime dateTime, VoiceWorkIngest[] ingests)
|
||||
{
|
||||
IClock clock = Substitute.For<IClock>();
|
||||
clock.UtcNow.Returns(new DateTimeOffset(dateTime));
|
||||
|
||||
TokyoTimeProvider timeProvider = new(clock);
|
||||
|
||||
VoiceWorkUpdater updater = new(dbContext, timeProvider);
|
||||
|
||||
return await updater.UpsertAsync(ingests, TestContext.Current.CancellationToken);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
using JSMR.Application.Common;
|
||||
using JSMR.Application.Scanning.Contracts;
|
||||
using JSMR.Application.Scanning.Ports;
|
||||
using JSMR.Domain.Entities;
|
||||
using JSMR.Infrastructure.Common.SupportedLanguages;
|
||||
using JSMR.Infrastructure.Data;
|
||||
using JSMR.Tests.Fixtures;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Shouldly;
|
||||
|
||||
namespace JSMR.Tests.Ingestion.Japanese;
|
||||
|
||||
public class Insert_New_Release_With_New_Tags_And_Creators_Tests(MariaDbContainerFixture container) : IngestionTestsBase(container)
|
||||
{
|
||||
[Fact]
|
||||
public async Task Insert_New_Release_With_New_Tags_And_Creators()
|
||||
{
|
||||
await using AppDbContext dbContext = await GetAppDbContextAsync();
|
||||
|
||||
VoiceWorkIngest ingest = new()
|
||||
{
|
||||
MakerId = "RG10001",
|
||||
MakerName = "New Dreams",
|
||||
ProductId = "RJ2000001",
|
||||
Title = "Day One Release",
|
||||
Description = "Releasing now.",
|
||||
Tags = ["アイドル", "メガネ"],
|
||||
Creators = ["かの仔"],
|
||||
WishlistCount = 50,
|
||||
Downloads = 10,
|
||||
HasTrial = false,
|
||||
HasDLPlay = false,
|
||||
StarRating = null,
|
||||
Votes = null,
|
||||
AgeRating = AgeRating.AllAges,
|
||||
HasImage = true,
|
||||
SupportedLanguages = [new JapaneseLanguage()],
|
||||
SalesDate = new DateOnly(2025, 1, 15),
|
||||
ExpectedDate = null
|
||||
};
|
||||
|
||||
VoiceWorkUpsertResult[] results = await UpsertAsync(dbContext, new DateTime(2025, 01, 15, 9, 0, 0), [ingest]);
|
||||
|
||||
VoiceWork? voiceWork = await dbContext.VoiceWorks.SingleAsync(v => v.ProductId == "RJ2000001", TestContext.Current.CancellationToken);
|
||||
voiceWork.ShouldNotBeNull();
|
||||
voiceWork.ProductName.ShouldBe("Day One Release");
|
||||
voiceWork.Description.ShouldBe("Releasing now.");
|
||||
voiceWork.SalesDate.ShouldNotBeNull();
|
||||
voiceWork.ExpectedDate.ShouldBeNull();
|
||||
voiceWork.Status.ShouldBe((byte)VoiceWorkStatus.NewRelease);
|
||||
|
||||
voiceWork.Circle.ShouldNotBeNull();
|
||||
voiceWork.Circle.MakerId.ShouldBe("RG10001");
|
||||
voiceWork.Circle.Name.ShouldBe("New Dreams");
|
||||
|
||||
voiceWork.Tags.OrderBy(t => t.Position).Select(vwt => vwt.Tag?.Name).ToArray()
|
||||
.ShouldBe(["アイドル", "メガネ"]);
|
||||
|
||||
voiceWork.Creators.OrderBy(c => c.Position).Select(vwc => vwc.Creator?.Name).ToArray()
|
||||
.ShouldBe(["かの仔"]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
using JSMR.Application.Common;
|
||||
using JSMR.Application.Scanning.Contracts;
|
||||
using JSMR.Application.Scanning.Ports;
|
||||
using JSMR.Domain.Entities;
|
||||
using JSMR.Infrastructure.Common.SupportedLanguages;
|
||||
using JSMR.Infrastructure.Data;
|
||||
using JSMR.Tests.Fixtures;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Shouldly;
|
||||
|
||||
namespace JSMR.Tests.Ingestion.Japanese;
|
||||
|
||||
public class Insert_New_Upcoming_With_Existing_Tags_And_Creators_Tests(MariaDbContainerFixture container) : IngestionTestsBase(container)
|
||||
{
|
||||
[Fact]
|
||||
public async Task Insert_New_Upcoming_With_Existing_Tags_And_Creators()
|
||||
{
|
||||
VoiceWorkIngest[] insertNewUpcomingIngests =
|
||||
[
|
||||
new()
|
||||
{
|
||||
MakerId = "RG00001",
|
||||
MakerName = "Good Dreams",
|
||||
ProductId = "RJ1000001",
|
||||
Title = "Brand New Preview",
|
||||
Description = "Teaser only.",
|
||||
Tags = ["ASMR", "メイド" ],
|
||||
Creators = ["秋野かえで"],
|
||||
WishlistCount = 250,
|
||||
Downloads = 0,
|
||||
HasTrial = false,
|
||||
HasDLPlay = false,
|
||||
StarRating = null,
|
||||
Votes = null,
|
||||
AgeRating = AgeRating.R15,
|
||||
HasImage = true,
|
||||
SupportedLanguages = [new JapaneseLanguage()],
|
||||
SalesDate = null,
|
||||
ExpectedDate = new DateOnly(2025, 1, 20),
|
||||
RegistrationDate = null
|
||||
}
|
||||
];
|
||||
|
||||
await using AppDbContext dbContext = await GetAppDbContextAsync();
|
||||
DateTime currentDateTime = new(2025, 01, 05, 10, 0, 0);
|
||||
|
||||
VoiceWorkUpsertResult[] results = await UpsertAsync(dbContext, currentDateTime, insertNewUpcomingIngests);
|
||||
|
||||
VoiceWork? voiceWork = await dbContext.VoiceWorks.SingleAsync(v => v.ProductId == "RJ1000001", TestContext.Current.CancellationToken);
|
||||
voiceWork.ShouldNotBeNull();
|
||||
voiceWork.ProductName.ShouldBe("Brand New Preview");
|
||||
voiceWork.Description.ShouldBe("Teaser only.");
|
||||
voiceWork.SalesDate.ShouldBeNull();
|
||||
voiceWork.ExpectedDate.ShouldNotBeNull();
|
||||
voiceWork.Status.ShouldBe((byte)VoiceWorkStatus.NewAndUpcoming);
|
||||
|
||||
voiceWork.Tags.OrderBy(t => t.Position).Select(vwt => vwt.Tag?.Name).ToArray()
|
||||
.ShouldBe(["ASMR", "メイド"]);
|
||||
|
||||
voiceWork.Creators.OrderBy(c => c.Position).Select(vwc => vwc.Creator?.Name).ToArray()
|
||||
.ShouldBe(["秋野かえで"]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
using JSMR.Application.Common;
|
||||
using JSMR.Application.Scanning.Contracts;
|
||||
using JSMR.Domain.Entities;
|
||||
using JSMR.Infrastructure.Common.SupportedLanguages;
|
||||
using JSMR.Infrastructure.Data;
|
||||
using JSMR.Tests.Fixtures;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Shouldly;
|
||||
|
||||
namespace JSMR.Tests.Ingestion.Japanese;
|
||||
|
||||
public class Insert_Upcoming_And_Scan_Again_Later_Tests(MariaDbContainerFixture container) : IngestionTestsBase(container)
|
||||
{
|
||||
[Fact]
|
||||
public async Task Insert_Upcoming_And_Scan_Again_Later()
|
||||
{
|
||||
await using AppDbContext dbContext = await GetAppDbContextAsync();
|
||||
|
||||
VoiceWorkIngest ingest = new()
|
||||
{
|
||||
MakerId = "RG00001",
|
||||
MakerName = "Good Dreams",
|
||||
ProductId = "RJ1000002",
|
||||
Title = "Preview Only",
|
||||
Description = "Still upcoming.",
|
||||
Tags = Array.Empty<string>(),
|
||||
Creators = Array.Empty<string>(),
|
||||
WishlistCount = 100,
|
||||
Downloads = 0,
|
||||
HasTrial = false,
|
||||
HasDLPlay = false,
|
||||
AgeRating = AgeRating.AllAges,
|
||||
HasImage = false,
|
||||
SupportedLanguages = [new JapaneseLanguage()],
|
||||
SalesDate = null,
|
||||
ExpectedDate = new DateOnly(2025, 2, 1)
|
||||
};
|
||||
|
||||
await UpsertAsync(dbContext, new DateTime(2025, 01, 10, 1, 0, 0), [ingest]);
|
||||
|
||||
VoiceWork? voiceWork = await dbContext.VoiceWorks.SingleAsync(v => v.ProductId == "RJ1000002", TestContext.Current.CancellationToken);
|
||||
voiceWork.Status.ShouldBe((byte)VoiceWorkStatus.NewAndUpcoming);
|
||||
|
||||
await UpsertAsync(dbContext, new DateTime(2025, 01, 12, 10, 0, 0), [ingest]);
|
||||
|
||||
VoiceWork? updatedVoiceWork = await dbContext.VoiceWorks.SingleAsync(v => v.ProductId == "RJ1000002", TestContext.Current.CancellationToken);
|
||||
updatedVoiceWork.Status.ShouldBe((byte)VoiceWorkStatus.Upcoming);
|
||||
}
|
||||
}
|
||||
@@ -1,49 +1,22 @@
|
||||
using JSMR.Application.Scanning.Contracts;
|
||||
using JSMR.Application.Common;
|
||||
using JSMR.Application.Scanning.Contracts;
|
||||
using JSMR.Application.Scanning.Ports;
|
||||
using JSMR.Domain.Entities;
|
||||
using JSMR.Infrastructure.Common.SupportedLanguages;
|
||||
using JSMR.Infrastructure.Common.Time;
|
||||
using JSMR.Infrastructure.Data;
|
||||
using JSMR.Infrastructure.Ingestion;
|
||||
using JSMR.Tests.Fixtures;
|
||||
using JSMR.Tests.Ingestion.Japanese;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using NSubstitute;
|
||||
using Shouldly;
|
||||
|
||||
namespace JSMR.Tests.Ingestion;
|
||||
|
||||
//public class VoiceWorkIngestionTests(VoiceWorkIngestionFixture fixture)
|
||||
//{
|
||||
// [Fact]
|
||||
// public async Task Simple_Upsert()
|
||||
// {
|
||||
// await using AppDbContext context = fixture.CreateDbContext();
|
||||
|
||||
// VoiceWorkIngest[] ingests =
|
||||
// [
|
||||
// // TODO
|
||||
// //new()
|
||||
// //{
|
||||
// // MakerId = "RG00001",
|
||||
// // MakerName = "Good Dreams",
|
||||
// // ProductId = "A Newly Announced Work",
|
||||
// // Title = "",
|
||||
// // Description = ""
|
||||
// //},
|
||||
// //new()
|
||||
// //{
|
||||
// // MakerId = "RG00002",
|
||||
// // MakerName = "Sweet Dreams",
|
||||
// // ProductId = "",
|
||||
// // Title = "",
|
||||
// // Description = ""
|
||||
// //}
|
||||
// ];
|
||||
|
||||
// IClock clock = Substitute.For<IClock>();
|
||||
// clock.UtcNow.Returns(new DateTimeOffset(2025, 1, 3, 0, 0, 0, 0, TimeSpan.FromSeconds(0)));
|
||||
public class VoiceWorkIngestionTests(MariaDbContainerFixture container) : IngestionTestsBase(container)
|
||||
{
|
||||
|
||||
// TokyoTimeProvider timeProvider = new(clock);
|
||||
|
||||
// VoiceWorkUpdater updater = new(context, timeProvider);
|
||||
// await updater.UpsertAsync(ingests, CancellationToken.None);
|
||||
|
||||
// // TODO
|
||||
// //context.VoiceWorks.Count().ShouldBe(2);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
Reference in New Issue
Block a user