Updated integration testing for English and Japanese. Fixed minor voice work updater issue. Updated to XUnitV3.
This commit is contained in:
@@ -97,15 +97,12 @@ public class EnglishVoiceWorkUpdater(AppDbContext dbContext, ILanguageIdentifier
|
|||||||
englishVoiceWork.Description = ingest.Description;
|
englishVoiceWork.Description = ingest.Description;
|
||||||
englishVoiceWork.IsValid = true;
|
englishVoiceWork.IsValid = true;
|
||||||
|
|
||||||
switch (dbContext.Entry(englishVoiceWork).State)
|
return dbContext.Entry(englishVoiceWork).State switch
|
||||||
{
|
{
|
||||||
case EntityState.Added:
|
EntityState.Added => VoiceWorkUpsertStatus.Inserted,
|
||||||
return VoiceWorkUpsertStatus.Inserted;
|
EntityState.Modified => VoiceWorkUpsertStatus.Updated,
|
||||||
case EntityState.Modified:
|
_ => VoiceWorkUpsertStatus.Unchanged,
|
||||||
return VoiceWorkUpsertStatus.Updated;
|
};
|
||||||
default:
|
|
||||||
return VoiceWorkUpsertStatus.Unchanged;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private EnglishVoiceWork GetOrAddEnglishVoiceWork(VoiceWorkIngest ingest, EnglishVoiceWorkUpsertContext upsertContext)
|
private EnglishVoiceWork GetOrAddEnglishVoiceWork(VoiceWorkIngest ingest, EnglishVoiceWorkUpsertContext upsertContext)
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ public class VoiceWorkUpdater(AppDbContext dbContext, ITimeProvider timeProvider
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (upsertContext.VoiceWorks.TryGetValue(ingest.MakerId, out VoiceWork? voiceWork) == false)
|
if (upsertContext.VoiceWorks.TryGetValue(ingest.ProductId, out VoiceWork? voiceWork) == false)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int ingestDownloads = ingest.Downloads;
|
int ingestDownloads = ingest.Downloads;
|
||||||
|
|||||||
@@ -7,13 +7,12 @@ public static class ScannerUtilities
|
|||||||
{
|
{
|
||||||
public static List<string> GetStringListFromNodes(HtmlNode[] nodes)
|
public static List<string> GetStringListFromNodes(HtmlNode[] nodes)
|
||||||
{
|
{
|
||||||
return nodes
|
return [.. nodes
|
||||||
.Where(node => string.IsNullOrEmpty(node.InnerHtml) == false)
|
.Where(node => string.IsNullOrEmpty(node.InnerHtml) == false)
|
||||||
.Select(node => HttpUtility.HtmlDecode(node.InnerHtml))
|
.Select(node => HttpUtility.HtmlDecode(node.InnerHtml))];
|
||||||
.ToList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string GetDecodedText(HtmlNode node)
|
public static string GetDecodedText(HtmlNode? node)
|
||||||
{
|
{
|
||||||
if (node == null)
|
if (node == null)
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ public abstract class VoiceWorksScanner(IHtmlLoader htmlLoader) : IVoiceWorksSca
|
|||||||
return AgeRating.R18;
|
return AgeRating.R18;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ScannedRating? GetScannedRating(HtmlNode starRatingNode)
|
private static ScannedRating? GetScannedRating(HtmlNode? starRatingNode)
|
||||||
{
|
{
|
||||||
if (starRatingNode == null)
|
if (starRatingNode == null)
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -26,3 +26,39 @@ public class CircleSearchProviderFixture : MariaDbFixture
|
|||||||
await context.SaveChangesAsync();
|
await context.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public sealed class CircleSearchProviderFixture2(MariaDbContainerFixture container) : IAsyncLifetime
|
||||||
|
{
|
||||||
|
public AppDbContext? DbContext { get; private set; }
|
||||||
|
|
||||||
|
public async ValueTask InitializeAsync()
|
||||||
|
{
|
||||||
|
DbContext = await MariaTestDb.CreateIsolatedAsync(
|
||||||
|
container.RootConnectionString,
|
||||||
|
seed: SeedAsync);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static async Task SeedAsync(AppDbContext context)
|
||||||
|
{
|
||||||
|
// Make seeding idempotent (quick existence check)
|
||||||
|
if (await context.Circles.AnyAsync())
|
||||||
|
return;
|
||||||
|
|
||||||
|
context.Circles.AddRange(
|
||||||
|
new() { CircleId = 1, Name = "Good Dreams", MakerId = "RG00001" },
|
||||||
|
new() { CircleId = 2, Name = "Sweet Dreams", Favorite = true, MakerId = "RG00002" },
|
||||||
|
new() { CircleId = 3, Name = "Nightmare Fuel", Blacklisted = true, MakerId = "RG00003" },
|
||||||
|
new() { CircleId = 4, Name = "Garbage Studio", Spam = true, MakerId = "RG00004" }
|
||||||
|
);
|
||||||
|
|
||||||
|
await context.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async ValueTask DisposeAsync()
|
||||||
|
{
|
||||||
|
if (DbContext is not null)
|
||||||
|
{
|
||||||
|
await DbContext.DisposeAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -24,3 +24,38 @@ public class CreatorSearchProviderFixture : MariaDbFixture
|
|||||||
await context.SaveChangesAsync();
|
await context.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public sealed class CreatorSearchProviderFixture2(MariaDbContainerFixture container) : IAsyncLifetime
|
||||||
|
{
|
||||||
|
public AppDbContext? DbContext { get; private set; }
|
||||||
|
|
||||||
|
public async ValueTask InitializeAsync()
|
||||||
|
{
|
||||||
|
DbContext = await MariaTestDb.CreateIsolatedAsync(
|
||||||
|
container.RootConnectionString,
|
||||||
|
seed: SeedAsync);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static async Task SeedAsync(AppDbContext context)
|
||||||
|
{
|
||||||
|
if (await context.Tags.AnyAsync())
|
||||||
|
return;
|
||||||
|
|
||||||
|
context.Creators.AddRange(
|
||||||
|
new() { CreatorId = 1, Name = "John Smith" },
|
||||||
|
new() { CreatorId = 2, Name = "John Doe", Favorite = true },
|
||||||
|
new() { CreatorId = 3, Name = "Jane Doe", Blacklisted = true }
|
||||||
|
);
|
||||||
|
|
||||||
|
await context.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async ValueTask DisposeAsync()
|
||||||
|
{
|
||||||
|
if (DbContext is not null)
|
||||||
|
{
|
||||||
|
await DbContext.DisposeAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,14 +1,57 @@
|
|||||||
using DotNet.Testcontainers.Builders;
|
using DotNet.Testcontainers.Builders;
|
||||||
using DotNet.Testcontainers.Containers;
|
using DotNet.Testcontainers.Containers;
|
||||||
using JSMR.Infrastructure.Data;
|
using JSMR.Infrastructure.Data;
|
||||||
|
using JSMR.Tests.Fixtures;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using MySqlConnector;
|
using MySqlConnector;
|
||||||
using Testcontainers.MariaDb;
|
using Testcontainers.MariaDb;
|
||||||
using Testcontainers.Xunit;
|
using Testcontainers.Xunit;
|
||||||
using Xunit.Abstractions;
|
using Xunit.Sdk;
|
||||||
|
|
||||||
|
[assembly: AssemblyFixture(typeof(MariaDbContainerFixture))]
|
||||||
|
|
||||||
namespace JSMR.Tests.Fixtures;
|
namespace JSMR.Tests.Fixtures;
|
||||||
|
|
||||||
|
|
||||||
|
public sealed class MariaDbContainerFixture : IAsyncLifetime
|
||||||
|
{
|
||||||
|
const int MajorVersion = 10;
|
||||||
|
const int MinorVersion = 11;
|
||||||
|
const int Build = 6;
|
||||||
|
|
||||||
|
private IContainer _container = default!;
|
||||||
|
public string RootConnectionString { get; private set; } = default!;
|
||||||
|
|
||||||
|
public async ValueTask InitializeAsync()
|
||||||
|
{
|
||||||
|
//_container = new ContainerBuilder()
|
||||||
|
// .WithImage("mariadb:11")
|
||||||
|
// .WithEnvironment("MARIADB_ROOT_PASSWORD", "rootpw")
|
||||||
|
// .WithPortBinding(3307, 3306)
|
||||||
|
// .WithWaitStrategy(Wait.ForUnixContainer().UntilPortIsAvailable(3306))
|
||||||
|
// .Build();
|
||||||
|
|
||||||
|
_container = new ContainerBuilder()
|
||||||
|
.WithImage($"mariadb:{MajorVersion}.{MinorVersion}.{Build}")
|
||||||
|
.WithEnvironment("MARIADB_ROOT_PASSWORD", "rootpw")
|
||||||
|
.WithPortBinding(3307, 3306)
|
||||||
|
//.WithPortBinding(3306, assignRandomHostPort: true)
|
||||||
|
.WithWaitStrategy(Wait.ForUnixContainer().UntilInternalTcpPortIsAvailable(3306))
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
await _container.StartAsync();
|
||||||
|
|
||||||
|
// No database specified: we’ll create per-test DBs
|
||||||
|
//RootConnectionString = "Server=127.0.0.1;Port=3307;User=root;Password=rootpw;SslMode=none;";
|
||||||
|
|
||||||
|
//RootConnectionString = _container.GetConnectionString();
|
||||||
|
var port = _container.GetMappedPublicPort(3306);
|
||||||
|
RootConnectionString = $"Server=127.0.0.1;Port={port};User=root;Password=rootpw;SslMode=none;";
|
||||||
|
}
|
||||||
|
|
||||||
|
public async ValueTask DisposeAsync() => await _container.DisposeAsync();
|
||||||
|
}
|
||||||
|
|
||||||
public class MariaDbFixture : IAsyncLifetime
|
public class MariaDbFixture : IAsyncLifetime
|
||||||
{
|
{
|
||||||
const int MajorVersion = 10;
|
const int MajorVersion = 10;
|
||||||
@@ -19,7 +62,7 @@ public class MariaDbFixture : IAsyncLifetime
|
|||||||
|
|
||||||
public string ConnectionString { get; private set; } = default!;
|
public string ConnectionString { get; private set; } = default!;
|
||||||
|
|
||||||
public async Task InitializeAsync()
|
public async ValueTask InitializeAsync()
|
||||||
{
|
{
|
||||||
MariaDbContainer = new MariaDbBuilder()
|
MariaDbContainer = new MariaDbBuilder()
|
||||||
.WithImage($"mariadb:{MajorVersion}.{MinorVersion}.{Build}")
|
.WithImage($"mariadb:{MajorVersion}.{MinorVersion}.{Build}")
|
||||||
@@ -40,13 +83,15 @@ public class MariaDbFixture : IAsyncLifetime
|
|||||||
return Task.FromResult(Task.CompletedTask);
|
return Task.FromResult(Task.CompletedTask);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task DisposeAsync()
|
public async ValueTask DisposeAsync()
|
||||||
{
|
{
|
||||||
if (MariaDbContainer is not null)
|
if (MariaDbContainer is not null)
|
||||||
{
|
{
|
||||||
await MariaDbContainer.StopAsync();
|
await MariaDbContainer.StopAsync();
|
||||||
await MariaDbContainer.DisposeAsync();
|
await MariaDbContainer.DisposeAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GC.SuppressFinalize(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AppDbContext CreateDbContext()
|
public AppDbContext CreateDbContext()
|
||||||
@@ -74,6 +119,9 @@ public class MariaDbFixture : IAsyncLifetime
|
|||||||
[CollectionDefinition("db")]
|
[CollectionDefinition("db")]
|
||||||
public sealed class MariaDbCollection : ICollectionFixture<MariaDbContainerFixture> { }
|
public sealed class MariaDbCollection : ICollectionFixture<MariaDbContainerFixture> { }
|
||||||
|
|
||||||
|
//public class MariaDbAssemblyFixtureDefinition : IAssemblyFixture<MariaDbContainerFixture> { }
|
||||||
|
|
||||||
|
|
||||||
//[UsedImplicitly]
|
//[UsedImplicitly]
|
||||||
public sealed class MariaDbContainerFixture2(IMessageSink messageSink)
|
public sealed class MariaDbContainerFixture2(IMessageSink messageSink)
|
||||||
: ContainerFixture<MariaDbBuilder, MariaDbContainer>(messageSink)
|
: ContainerFixture<MariaDbBuilder, MariaDbContainer>(messageSink)
|
||||||
@@ -94,46 +142,6 @@ public sealed class MariaDbContainerFixture2(IMessageSink messageSink)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public sealed class MariaDbContainerFixture : IAsyncLifetime
|
|
||||||
{
|
|
||||||
const int MajorVersion = 10;
|
|
||||||
const int MinorVersion = 11;
|
|
||||||
const int Build = 6;
|
|
||||||
|
|
||||||
private IContainer _container = default!;
|
|
||||||
public string RootConnectionString { get; private set; } = default!;
|
|
||||||
|
|
||||||
public async Task InitializeAsync()
|
|
||||||
{
|
|
||||||
//_container = new ContainerBuilder()
|
|
||||||
// .WithImage("mariadb:11")
|
|
||||||
// .WithEnvironment("MARIADB_ROOT_PASSWORD", "rootpw")
|
|
||||||
// .WithPortBinding(3307, 3306)
|
|
||||||
// .WithWaitStrategy(Wait.ForUnixContainer().UntilPortIsAvailable(3306))
|
|
||||||
// .Build();
|
|
||||||
|
|
||||||
_container = new ContainerBuilder()
|
|
||||||
.WithImage($"mariadb:{MajorVersion}.{MinorVersion}.{Build}")
|
|
||||||
.WithEnvironment("MARIADB_ROOT_PASSWORD", "rootpw")
|
|
||||||
.WithPortBinding(3307, 3306)
|
|
||||||
//.WithPortBinding(3306, assignRandomHostPort: true)
|
|
||||||
.WithWaitStrategy(Wait.ForUnixContainer().UntilInternalTcpPortIsAvailable(3306))
|
|
||||||
.Build();
|
|
||||||
|
|
||||||
await _container.StartAsync();
|
|
||||||
|
|
||||||
// No database specified: we’ll create per-test DBs
|
|
||||||
//RootConnectionString = "Server=127.0.0.1;Port=3307;User=root;Password=rootpw;SslMode=none;";
|
|
||||||
|
|
||||||
//RootConnectionString = _container.GetConnectionString();
|
|
||||||
var port = _container.GetMappedPublicPort(3306);
|
|
||||||
RootConnectionString = $"Server=127.0.0.1;Port={port};User=root;Password=rootpw;SslMode=none;";
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task DisposeAsync() => await _container.DisposeAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class MariaTestDb
|
public static class MariaTestDb
|
||||||
{
|
{
|
||||||
public static async Task<AppDbContext> CreateIsolatedAsync(string rootConnectionString, Func<AppDbContext, Task>? seed = null)
|
public static async Task<AppDbContext> CreateIsolatedAsync(string rootConnectionString, Func<AppDbContext, Task>? seed = null)
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public sealed class TagSearchProviderFixture2(MariaDbContainerFixture container)
|
|||||||
{
|
{
|
||||||
public AppDbContext? DbContext { get; private set; }
|
public AppDbContext? DbContext { get; private set; }
|
||||||
|
|
||||||
public async Task InitializeAsync()
|
public async ValueTask InitializeAsync()
|
||||||
{
|
{
|
||||||
DbContext = await MariaTestDb.CreateIsolatedAsync(
|
DbContext = await MariaTestDb.CreateIsolatedAsync(
|
||||||
container.RootConnectionString,
|
container.RootConnectionString,
|
||||||
@@ -65,7 +65,7 @@ public sealed class TagSearchProviderFixture2(MariaDbContainerFixture container)
|
|||||||
await context.SaveChangesAsync();
|
await context.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task DisposeAsync()
|
public async ValueTask DisposeAsync()
|
||||||
{
|
{
|
||||||
if (DbContext is not null)
|
if (DbContext is not null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -125,3 +125,137 @@ public class VoiceWorkSearchProviderFixture : MariaDbFixture
|
|||||||
await context.SaveChangesAsync();
|
await context.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public sealed class VoiceWorkSearchProviderFixture2(MariaDbContainerFixture container) : IAsyncLifetime
|
||||||
|
{
|
||||||
|
public AppDbContext? DbContext { get; private set; }
|
||||||
|
|
||||||
|
public async ValueTask InitializeAsync()
|
||||||
|
{
|
||||||
|
DbContext = await MariaTestDb.CreateIsolatedAsync(
|
||||||
|
container.RootConnectionString,
|
||||||
|
seed: SeedAsync);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static async Task SeedAsync(AppDbContext context)
|
||||||
|
{
|
||||||
|
if (await context.VoiceWorks.AnyAsync())
|
||||||
|
return;
|
||||||
|
|
||||||
|
context.Circles.AddRange(
|
||||||
|
new() { CircleId = 1, Name = "Good Dreams", MakerId = "RG00001" },
|
||||||
|
new() { CircleId = 2, Name = "Sweet Dreams", Favorite = true, MakerId = "RG00002" },
|
||||||
|
new() { CircleId = 3, Name = "Nightmare Fuel", Blacklisted = true, MakerId = "RG00003" }
|
||||||
|
);
|
||||||
|
|
||||||
|
context.VoiceWorks.AddRange(
|
||||||
|
new() { VoiceWorkId = 1, CircleId = 1, ProductId = "RJ0000001", ProductName = "Today Sounds", Description = "An average product.", Status = (byte)VoiceWorkStatus.Available, SalesDate = new(2025, 1, 1), Downloads = 500, WishlistCount = 750, StarRating = 35 },
|
||||||
|
new() { VoiceWorkId = 2, CircleId = 2, ProductId = "RJ0000002", ProductName = "Super Comfy ASMR", Description = "An amazing product!", Status = (byte)VoiceWorkStatus.NewRelease, SalesDate = new(2025, 1, 3), Downloads = 5000, WishlistCount = 12000, StarRating = 50, Favorite = true },
|
||||||
|
new() { VoiceWorkId = 3, CircleId = 3, ProductId = "RJ0000003", ProductName = "Low Effort", Description = "A bad product.", Status = (byte)VoiceWorkStatus.Available, SalesDate = new(2025, 1, 2), Downloads = 50, WishlistCount = 100, StarRating = 20 },
|
||||||
|
new() { VoiceWorkId = 4, CircleId = 1, ProductId = "RJ0000004", ProductName = "Tomorrow Sounds", Description = "A average upcoming product.", Status = (byte)VoiceWorkStatus.Upcoming, ExpectedDate = new(2025, 1, 1), WishlistCount = 300 },
|
||||||
|
new() { VoiceWorkId = 5, CircleId = 2, ProductId = "RJ0000005", ProductName = "Super Comfy ASMR+", Description = "All your favorite sounds, plus more!", Status = (byte)VoiceWorkStatus.NewAndUpcoming, ExpectedDate = new(2025, 1, 11), WishlistCount = 10000 }
|
||||||
|
);
|
||||||
|
|
||||||
|
context.Tags.AddRange(
|
||||||
|
new() { TagId = 1, Name = "ASMR" },
|
||||||
|
new() { TagId = 2, Name = "OL" },
|
||||||
|
new() { TagId = 3, Name = "ほのぼの" },
|
||||||
|
new() { TagId = 4, Name = "エルフ/妖精" },
|
||||||
|
new() { TagId = 5, Name = "ツンデレ", Favorite = true },
|
||||||
|
new() { TagId = 6, Name = "オールハッピー" },
|
||||||
|
new() { TagId = 7, Name = "ギャル" },
|
||||||
|
new() { TagId = 8, Name = "メイド" },
|
||||||
|
new() { TagId = 9, Name = "ノンフィクション/体験談", Blacklisted = true }
|
||||||
|
);
|
||||||
|
|
||||||
|
context.EnglishTags.AddRange(
|
||||||
|
new() { EnglishTagId = 1, TagId = 1, Name = "ASMR" },
|
||||||
|
new() { EnglishTagId = 2, TagId = 2, Name = "Office Lady" },
|
||||||
|
new() { EnglishTagId = 3, TagId = 3, Name = "Heartwarming" },
|
||||||
|
new() { EnglishTagId = 4, TagId = 4, Name = "Elf / Fairy" },
|
||||||
|
new() { EnglishTagId = 5, TagId = 5, Name = "Tsundere" },
|
||||||
|
new() { EnglishTagId = 6, TagId = 6, Name = "All Happy" },
|
||||||
|
new() { EnglishTagId = 7, TagId = 7, Name = "Gal" },
|
||||||
|
new() { EnglishTagId = 8, TagId = 8, Name = "Maid" },
|
||||||
|
new() { EnglishTagId = 9, TagId = 9, Name = "Non-Fiction / Narrative" }
|
||||||
|
);
|
||||||
|
|
||||||
|
context.VoiceWorkTags.AddRange(
|
||||||
|
new() { VoiceWorkId = 1, TagId = 1 }, // ASMR
|
||||||
|
new() { VoiceWorkId = 1, TagId = 2 }, // Office Lady
|
||||||
|
|
||||||
|
new() { VoiceWorkId = 2, TagId = 1 }, // ASMR
|
||||||
|
new() { VoiceWorkId = 2, TagId = 3 }, // Heartwarming
|
||||||
|
new() { VoiceWorkId = 2, TagId = 4 }, // Elf / Fairy
|
||||||
|
new() { VoiceWorkId = 2, TagId = 5 }, // Tsundere
|
||||||
|
new() { VoiceWorkId = 2, TagId = 6 }, // All Happy
|
||||||
|
new() { VoiceWorkId = 2, TagId = 7 }, // Gal
|
||||||
|
new() { VoiceWorkId = 2, TagId = 8 }, // Maid
|
||||||
|
|
||||||
|
new() { VoiceWorkId = 3, TagId = 5 }, // Tsundere
|
||||||
|
new() { VoiceWorkId = 3, TagId = 9 } // Non-Fiction / Narrative
|
||||||
|
//new() { VoiceWorkId = 3, TagId = 1 },
|
||||||
|
//new() { VoiceWorkId = 3, TagId = 1 },
|
||||||
|
//new() { VoiceWorkId = 3, TagId = 1 },
|
||||||
|
//new() { VoiceWorkId = 3, TagId = 1 },
|
||||||
|
//new() { VoiceWorkId = 3, TagId = 1 },
|
||||||
|
|
||||||
|
//new() { VoiceWorkId = 4, TagId = 1 },
|
||||||
|
//new() { VoiceWorkId = 4, TagId = 1 },
|
||||||
|
//new() { VoiceWorkId = 4, TagId = 1 },
|
||||||
|
//new() { VoiceWorkId = 4, TagId = 1 },
|
||||||
|
//new() { VoiceWorkId = 4, TagId = 1 },
|
||||||
|
//new() { VoiceWorkId = 4, TagId = 1 },
|
||||||
|
//new() { VoiceWorkId = 4, TagId = 1 },
|
||||||
|
|
||||||
|
//new() { VoiceWorkId = 5, TagId = 5 } // Tsundere
|
||||||
|
//new() { VoiceWorkId = 5, TagId = 1 },
|
||||||
|
//new() { VoiceWorkId = 5, TagId = 1 },
|
||||||
|
//new() { VoiceWorkId = 5, TagId = 1 },
|
||||||
|
//new() { VoiceWorkId = 5, TagId = 1 },
|
||||||
|
//new() { VoiceWorkId = 5, TagId = 1 },
|
||||||
|
//new() { VoiceWorkId = 5, TagId = 1 }
|
||||||
|
);
|
||||||
|
|
||||||
|
context.Creators.AddRange(
|
||||||
|
new() { CreatorId = 1, Name = "陽向葵ゅか", Favorite = true },
|
||||||
|
new() { CreatorId = 2, Name = "秋野かえで" },
|
||||||
|
new() { CreatorId = 3, Name = "柚木つばめ" },
|
||||||
|
new() { CreatorId = 4, Name = "逢坂成美" },
|
||||||
|
new() { CreatorId = 5, Name = "山田じぇみ子", Blacklisted = true }
|
||||||
|
);
|
||||||
|
|
||||||
|
context.VoiceWorkCreators.AddRange(
|
||||||
|
new() { VoiceWorkId = 1, CreatorId = 2 }, // 秋野かえで
|
||||||
|
|
||||||
|
new() { VoiceWorkId = 2, CreatorId = 1 }, // 陽向葵ゅか
|
||||||
|
|
||||||
|
new() { VoiceWorkId = 3, CreatorId = 5 }, // 山田じぇみ子
|
||||||
|
new() { VoiceWorkId = 3, CreatorId = 1 }, // 陽向葵ゅか
|
||||||
|
|
||||||
|
new() { VoiceWorkId = 4, CreatorId = 3 }, // 柚木つばめ
|
||||||
|
|
||||||
|
new() { VoiceWorkId = 5, CreatorId = 1 }, // 陽向葵ゅか
|
||||||
|
new() { VoiceWorkId = 5, CreatorId = 4 } // 逢坂成美
|
||||||
|
);
|
||||||
|
|
||||||
|
// <Product Id> <Maker Id> <Circle Name> <Product Name> <Product Description> <Tags> <Creators>
|
||||||
|
context.VoiceWorkSearches.AddRange(
|
||||||
|
new() { VoiceWorkId = 1, SearchText = "RJ0000001 RG00001 Good Dreams Today Sounds An average product. ASMR Office Lady" },
|
||||||
|
new() { VoiceWorkId = 2, SearchText = "RJ0000002 RG00002 Sweet Dreams Super Comfy ASMR An amazing product! ASMR Heartwarming Elf / Fairy Tsundere All Happy Gal Maid" },
|
||||||
|
new() { VoiceWorkId = 3, SearchText = "RJ0000003 RG00003 Nightmare Fuel Low Effort A bad product." },
|
||||||
|
new() { VoiceWorkId = 4, SearchText = "RJ0000004 RG00001 Good Dreams Tomorrow Sounds A average upcoming product." },
|
||||||
|
new() { VoiceWorkId = 5, SearchText = "RJ0000005 RG00002 Sweet Dreams Super Comfy ASMR+ All your favorite sounds, plus more!" }
|
||||||
|
);
|
||||||
|
|
||||||
|
await context.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async ValueTask DisposeAsync()
|
||||||
|
{
|
||||||
|
if (DbContext is not null)
|
||||||
|
{
|
||||||
|
await DbContext.DisposeAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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.Contracts;
|
||||||
using JSMR.Application.Scanning.Ports;
|
//using JSMR.Application.Scanning.Ports;
|
||||||
using JSMR.Domain.Entities;
|
//using JSMR.Domain.Entities;
|
||||||
using JSMR.Infrastructure.Common.Languages;
|
//using JSMR.Infrastructure.Common.Languages;
|
||||||
using JSMR.Infrastructure.Data;
|
//using JSMR.Infrastructure.Data;
|
||||||
using JSMR.Infrastructure.Ingestion;
|
//using JSMR.Infrastructure.Ingestion;
|
||||||
using JSMR.Tests.Fixtures;
|
//using JSMR.Tests.Fixtures;
|
||||||
using Microsoft.EntityFrameworkCore;
|
//using Microsoft.EntityFrameworkCore;
|
||||||
using Shouldly;
|
//using Shouldly;
|
||||||
|
|
||||||
namespace JSMR.Tests.Ingestion;
|
//namespace JSMR.Tests.Ingestion;
|
||||||
|
|
||||||
public class EnglishLocalizationTests(MariaDbContainerFixture container) : IClassFixture<MariaDbContainerFixture>
|
//public class EnglishLocalizationTests(MariaDbContainerFixture container) //: IClassFixture<MariaDbContainerFixture>
|
||||||
{
|
//{
|
||||||
private readonly LanguageIdentifier languageIdentifier = new();
|
// private readonly LanguageIdentifier languageIdentifier = new();
|
||||||
|
|
||||||
[Fact]
|
// [Fact]
|
||||||
public async Task Insert_Then_Update()
|
// public async Task Insert_Then_Update()
|
||||||
{
|
// {
|
||||||
await using AppDbContext dbContext = await MariaTestDb.CreateIsolatedAsync(
|
// await using AppDbContext dbContext = await MariaTestDb.CreateIsolatedAsync(
|
||||||
container.RootConnectionString,
|
// container.RootConnectionString,
|
||||||
seed: VoiceWorkIngestionSeedData.SeedAsync);
|
// seed: VoiceWorkIngestionSeedData.SeedAsync);
|
||||||
|
|
||||||
// Part 1 -- Insert
|
// // Part 1 -- Insert
|
||||||
VoiceWorkIngest ingest = new()
|
// VoiceWorkIngest ingest = new()
|
||||||
{
|
// {
|
||||||
MakerId = "RG00001",
|
// MakerId = "RG00001",
|
||||||
MakerName = "Good Dreams",
|
// MakerName = "Good Dreams",
|
||||||
ProductId = "RJ0000001",
|
// ProductId = "RJ0000001",
|
||||||
Title = "Today Sounds (EN)",
|
// Title = "Today Sounds (EN)",
|
||||||
Description = "An average product. (EN)"
|
// Description = "An average product. (EN)"
|
||||||
};
|
// };
|
||||||
|
|
||||||
EnglishVoiceWorkUpdater updater = new(dbContext, languageIdentifier);
|
// EnglishVoiceWorkUpdater updater = new(dbContext, languageIdentifier);
|
||||||
VoiceWorkUpsertResult[] results = await updater.UpsertAsync([ingest], CancellationToken.None);
|
// VoiceWorkUpsertResult[] results = await updater.UpsertAsync([ingest], CancellationToken.None);
|
||||||
|
|
||||||
VoiceWork voiceWork = await dbContext.VoiceWorks.SingleAsync(v => v.ProductId == "RJ0000001");
|
// VoiceWork voiceWork = await dbContext.VoiceWorks.SingleAsync(v => v.ProductId == "RJ0000001");
|
||||||
EnglishVoiceWork? englishVoiceWork = await dbContext.EnglishVoiceWorks.SingleOrDefaultAsync(e => e.VoiceWorkId == voiceWork.VoiceWorkId);
|
// EnglishVoiceWork? englishVoiceWork = await dbContext.EnglishVoiceWorks.SingleOrDefaultAsync(e => e.VoiceWorkId == voiceWork.VoiceWorkId);
|
||||||
|
|
||||||
englishVoiceWork.ShouldNotBeNull();
|
// englishVoiceWork.ShouldNotBeNull();
|
||||||
englishVoiceWork.ProductName.ShouldBe("Today Sounds (EN)");
|
// englishVoiceWork.ProductName.ShouldBe("Today Sounds (EN)");
|
||||||
englishVoiceWork.Description.ShouldBe("An average product. (EN)");
|
// englishVoiceWork.Description.ShouldBe("An average product. (EN)");
|
||||||
englishVoiceWork.IsValid?.ShouldBeTrue();
|
// englishVoiceWork.IsValid?.ShouldBeTrue();
|
||||||
|
|
||||||
results.Length.ShouldBe(1);
|
// results.Length.ShouldBe(1);
|
||||||
results.Count(r => r.Status == VoiceWorkUpsertStatus.Inserted).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.Updated).ShouldBe(0);
|
||||||
results.Count(r => r.Status == VoiceWorkUpsertStatus.Skipped).ShouldBe(0);
|
// results.Count(r => r.Status == VoiceWorkUpsertStatus.Skipped).ShouldBe(0);
|
||||||
results.Count(r => r.Status == VoiceWorkUpsertStatus.Unchanged).ShouldBe(0);
|
// results.Count(r => r.Status == VoiceWorkUpsertStatus.Unchanged).ShouldBe(0);
|
||||||
results.Sum(r => r.Issues.Count).ShouldBe(0);
|
// results.Sum(r => r.Issues.Count).ShouldBe(0);
|
||||||
|
|
||||||
// Part 2 -- Update
|
// // Part 2 -- Update
|
||||||
VoiceWorkIngest ingestUpdate = ingest with
|
// VoiceWorkIngest ingestUpdate = ingest with
|
||||||
{
|
// {
|
||||||
Title = "Today Sounds (EN v2)",
|
// Title = "Today Sounds (EN v2)",
|
||||||
Description = "Updated English description."
|
// 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);
|
// EnglishVoiceWork? updatedEnglishVoiceWork = await dbContext.EnglishVoiceWorks.SingleOrDefaultAsync(e => e.VoiceWorkId == voiceWork.VoiceWorkId);
|
||||||
updatedEnglishVoiceWork.ShouldNotBeNull();
|
// updatedEnglishVoiceWork.ShouldNotBeNull();
|
||||||
updatedEnglishVoiceWork.ProductName.ShouldBe("Today Sounds (EN v2)");
|
// updatedEnglishVoiceWork.ProductName.ShouldBe("Today Sounds (EN v2)");
|
||||||
updatedEnglishVoiceWork.Description.ShouldBe("Updated English description.");
|
// updatedEnglishVoiceWork.Description.ShouldBe("Updated English description.");
|
||||||
updatedEnglishVoiceWork.IsValid?.ShouldBeTrue();
|
// updatedEnglishVoiceWork.IsValid?.ShouldBeTrue();
|
||||||
|
|
||||||
updatedResults.Length.ShouldBe(1);
|
// updatedResults.Length.ShouldBe(1);
|
||||||
updatedResults.Count(r => r.Status == VoiceWorkUpsertStatus.Inserted).ShouldBe(0);
|
// updatedResults.Count(r => r.Status == VoiceWorkUpsertStatus.Inserted).ShouldBe(0);
|
||||||
updatedResults.Count(r => r.Status == VoiceWorkUpsertStatus.Updated).ShouldBe(1);
|
// updatedResults.Count(r => r.Status == VoiceWorkUpsertStatus.Updated).ShouldBe(1);
|
||||||
updatedResults.Count(r => r.Status == VoiceWorkUpsertStatus.Skipped).ShouldBe(0);
|
// updatedResults.Count(r => r.Status == VoiceWorkUpsertStatus.Skipped).ShouldBe(0);
|
||||||
updatedResults.Count(r => r.Status == VoiceWorkUpsertStatus.Unchanged).ShouldBe(0);
|
// updatedResults.Count(r => r.Status == VoiceWorkUpsertStatus.Unchanged).ShouldBe(0);
|
||||||
updatedResults.Sum(r => r.Issues.Count).ShouldBe(0);
|
// updatedResults.Sum(r => r.Issues.Count).ShouldBe(0);
|
||||||
|
|
||||||
// Part 3 -- Update Again (No Change)
|
// // Part 3 -- Update Again (No Change)
|
||||||
VoiceWorkUpsertResult[] updatedAgainResults = await updater.UpsertAsync([ingestUpdate], CancellationToken.None);
|
// VoiceWorkUpsertResult[] updatedAgainResults = await updater.UpsertAsync([ingestUpdate], CancellationToken.None);
|
||||||
|
|
||||||
EnglishVoiceWork? updatedAgainEnglishVoiceWork = await dbContext.EnglishVoiceWorks.SingleOrDefaultAsync(e => e.VoiceWorkId == voiceWork.VoiceWorkId);
|
// EnglishVoiceWork? updatedAgainEnglishVoiceWork = await dbContext.EnglishVoiceWorks.SingleOrDefaultAsync(e => e.VoiceWorkId == voiceWork.VoiceWorkId);
|
||||||
updatedAgainEnglishVoiceWork.ShouldNotBeNull();
|
// updatedAgainEnglishVoiceWork.ShouldNotBeNull();
|
||||||
updatedAgainEnglishVoiceWork.ProductName.ShouldBe("Today Sounds (EN v2)");
|
// updatedAgainEnglishVoiceWork.ProductName.ShouldBe("Today Sounds (EN v2)");
|
||||||
updatedAgainEnglishVoiceWork.Description.ShouldBe("Updated English description.");
|
// updatedAgainEnglishVoiceWork.Description.ShouldBe("Updated English description.");
|
||||||
updatedAgainEnglishVoiceWork.IsValid?.ShouldBeTrue();
|
// updatedAgainEnglishVoiceWork.IsValid?.ShouldBeTrue();
|
||||||
|
|
||||||
updatedAgainResults.Length.ShouldBe(1);
|
// updatedAgainResults.Length.ShouldBe(1);
|
||||||
updatedAgainResults.Count(r => r.Status == VoiceWorkUpsertStatus.Inserted).ShouldBe(0);
|
// updatedAgainResults.Count(r => r.Status == VoiceWorkUpsertStatus.Inserted).ShouldBe(0);
|
||||||
updatedAgainResults.Count(r => r.Status == VoiceWorkUpsertStatus.Updated).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.Skipped).ShouldBe(0);
|
||||||
updatedAgainResults.Count(r => r.Status == VoiceWorkUpsertStatus.Unchanged).ShouldBe(1);
|
// updatedAgainResults.Count(r => r.Status == VoiceWorkUpsertStatus.Unchanged).ShouldBe(1);
|
||||||
updatedAgainResults.Sum(r => r.Issues.Count).ShouldBe(0);
|
// updatedAgainResults.Sum(r => r.Issues.Count).ShouldBe(0);
|
||||||
}
|
// }
|
||||||
|
|
||||||
[Fact]
|
// [Fact]
|
||||||
public async Task Fail_Attempted_Insert_With_Missing_Circle()
|
// public async Task Fail_Attempted_Insert_With_Missing_Circle()
|
||||||
{
|
// {
|
||||||
await using AppDbContext dbContext = await MariaTestDb.CreateIsolatedAsync(
|
// await using AppDbContext dbContext = await MariaTestDb.CreateIsolatedAsync(
|
||||||
container.RootConnectionString,
|
// container.RootConnectionString,
|
||||||
seed: VoiceWorkIngestionSeedData.SeedAsync);
|
// seed: VoiceWorkIngestionSeedData.SeedAsync);
|
||||||
|
|
||||||
VoiceWorkIngest ingest = new()
|
// VoiceWorkIngest ingest = new()
|
||||||
{
|
// {
|
||||||
MakerId = "RG99999",
|
// MakerId = "RG99999",
|
||||||
MakerName = "Missing Maker",
|
// MakerName = "Missing Maker",
|
||||||
ProductId = "RJ9999999",
|
// ProductId = "RJ9999999",
|
||||||
Title = "EN Title",
|
// Title = "EN Title",
|
||||||
Description = "EN Desc"
|
// Description = "EN Desc"
|
||||||
};
|
// };
|
||||||
|
|
||||||
EnglishVoiceWorkUpdater updater = new(dbContext, languageIdentifier);
|
// EnglishVoiceWorkUpdater updater = new(dbContext, languageIdentifier);
|
||||||
VoiceWorkUpsertResult[] results = await updater.UpsertAsync([ingest], CancellationToken.None);
|
// VoiceWorkUpsertResult[] results = await updater.UpsertAsync([ingest], CancellationToken.None);
|
||||||
|
|
||||||
int englishVoiceWorkCount = await dbContext.EnglishVoiceWorks.CountAsync(CancellationToken.None);
|
// int englishVoiceWorkCount = await dbContext.EnglishVoiceWorks.CountAsync(CancellationToken.None);
|
||||||
englishVoiceWorkCount.ShouldBe(0);
|
// englishVoiceWorkCount.ShouldBe(0);
|
||||||
|
|
||||||
results.Length.ShouldBe(1);
|
// results.Length.ShouldBe(1);
|
||||||
results.Count(r => r.Status == VoiceWorkUpsertStatus.Inserted).ShouldBe(0);
|
// results.Count(r => r.Status == VoiceWorkUpsertStatus.Inserted).ShouldBe(0);
|
||||||
results.Count(r => r.Status == VoiceWorkUpsertStatus.Updated).ShouldBe(0);
|
// results.Count(r => r.Status == VoiceWorkUpsertStatus.Updated).ShouldBe(0);
|
||||||
results.Count(r => r.Status == VoiceWorkUpsertStatus.Skipped).ShouldBe(1);
|
// results.Count(r => r.Status == VoiceWorkUpsertStatus.Skipped).ShouldBe(1);
|
||||||
results.Sum(r => r.Issues.Count).ShouldBe(1);
|
// results.Sum(r => r.Issues.Count).ShouldBe(1);
|
||||||
|
|
||||||
VoiceWorkUpsertIssue issue = results[0].Issues.ElementAt(0);
|
// VoiceWorkUpsertIssue issue = results[0].Issues.ElementAt(0);
|
||||||
issue.Severity.ShouldBe(VoiceWorkUpsertIssueSeverity.Error);
|
// issue.Severity.ShouldBe(VoiceWorkUpsertIssueSeverity.Error);
|
||||||
issue.Message.ShouldBe($"Unable to find circle for maker id: {ingest.MakerId}");
|
// issue.Message.ShouldBe($"Unable to find circle for maker id: {ingest.MakerId}");
|
||||||
}
|
// }
|
||||||
|
|
||||||
[Fact]
|
// [Fact]
|
||||||
public async Task Fail_Attempted_Insert_With_Missing_Product()
|
// public async Task Fail_Attempted_Insert_With_Missing_Product()
|
||||||
{
|
// {
|
||||||
await using AppDbContext dbContext = await MariaTestDb.CreateIsolatedAsync(
|
// await using AppDbContext dbContext = await MariaTestDb.CreateIsolatedAsync(
|
||||||
container.RootConnectionString,
|
// container.RootConnectionString,
|
||||||
seed: VoiceWorkIngestionSeedData.SeedAsync);
|
// seed: VoiceWorkIngestionSeedData.SeedAsync);
|
||||||
|
|
||||||
VoiceWorkIngest ingest = new()
|
// VoiceWorkIngest ingest = new()
|
||||||
{
|
// {
|
||||||
MakerId = "RG00001",
|
// MakerId = "RG00001",
|
||||||
MakerName = "Good Dreams",
|
// MakerName = "Good Dreams",
|
||||||
ProductId = "RJ9999999",
|
// ProductId = "RJ9999999",
|
||||||
Title = "EN Title",
|
// Title = "EN Title",
|
||||||
Description = "EN Desc"
|
// Description = "EN Desc"
|
||||||
};
|
// };
|
||||||
|
|
||||||
EnglishVoiceWorkUpdater updater = new(dbContext, languageIdentifier);
|
// EnglishVoiceWorkUpdater updater = new(dbContext, languageIdentifier);
|
||||||
VoiceWorkUpsertResult[] results = await updater.UpsertAsync([ingest], CancellationToken.None);
|
// VoiceWorkUpsertResult[] results = await updater.UpsertAsync([ingest], CancellationToken.None);
|
||||||
|
|
||||||
int englishVoiceWorkCount = await dbContext.EnglishVoiceWorks.CountAsync(CancellationToken.None);
|
// int englishVoiceWorkCount = await dbContext.EnglishVoiceWorks.CountAsync(CancellationToken.None);
|
||||||
englishVoiceWorkCount.ShouldBe(0);
|
// englishVoiceWorkCount.ShouldBe(0);
|
||||||
|
|
||||||
results.Length.ShouldBe(1);
|
// results.Length.ShouldBe(1);
|
||||||
results.Count(r => r.Status == VoiceWorkUpsertStatus.Inserted).ShouldBe(0);
|
// results.Count(r => r.Status == VoiceWorkUpsertStatus.Inserted).ShouldBe(0);
|
||||||
results.Count(r => r.Status == VoiceWorkUpsertStatus.Updated).ShouldBe(0);
|
// results.Count(r => r.Status == VoiceWorkUpsertStatus.Updated).ShouldBe(0);
|
||||||
results.Count(r => r.Status == VoiceWorkUpsertStatus.Skipped).ShouldBe(1);
|
// results.Count(r => r.Status == VoiceWorkUpsertStatus.Skipped).ShouldBe(1);
|
||||||
results.Sum(r => r.Issues.Count).ShouldBe(1);
|
// results.Sum(r => r.Issues.Count).ShouldBe(1);
|
||||||
|
|
||||||
VoiceWorkUpsertIssue issue = results[0].Issues.ElementAt(0);
|
// VoiceWorkUpsertIssue issue = results[0].Issues.ElementAt(0);
|
||||||
issue.Severity.ShouldBe(VoiceWorkUpsertIssueSeverity.Error);
|
// issue.Severity.ShouldBe(VoiceWorkUpsertIssueSeverity.Error);
|
||||||
issue.Message.ShouldBe($"Unable to find voice work for product id: {ingest.ProductId}");
|
// issue.Message.ShouldBe($"Unable to find voice work for product id: {ingest.ProductId}");
|
||||||
}
|
// }
|
||||||
|
|
||||||
[Fact]
|
// [Fact]
|
||||||
public async Task Fail_Attempted_Insert_When_Not_English()
|
// public async Task Fail_Attempted_Insert_When_Not_English()
|
||||||
{
|
// {
|
||||||
await using AppDbContext dbContext = await MariaTestDb.CreateIsolatedAsync(
|
// await using AppDbContext dbContext = await MariaTestDb.CreateIsolatedAsync(
|
||||||
container.RootConnectionString,
|
// container.RootConnectionString,
|
||||||
seed: VoiceWorkIngestionSeedData.SeedAsync);
|
// seed: VoiceWorkIngestionSeedData.SeedAsync);
|
||||||
|
|
||||||
VoiceWorkIngest ingest = new()
|
// VoiceWorkIngest ingest = new()
|
||||||
{
|
// {
|
||||||
MakerId = "RG00001",
|
// MakerId = "RG00001",
|
||||||
MakerName = "Good Dreams",
|
// MakerName = "Good Dreams",
|
||||||
ProductId = "RJ0000001",
|
// ProductId = "RJ0000001",
|
||||||
Title = "すごく快適なASMR",
|
// Title = "すごく快適なASMR",
|
||||||
Description = "最高の製品です!"
|
// Description = "最高の製品です!"
|
||||||
};
|
// };
|
||||||
|
|
||||||
EnglishVoiceWorkUpdater updater = new(dbContext, languageIdentifier);
|
// EnglishVoiceWorkUpdater updater = new(dbContext, languageIdentifier);
|
||||||
VoiceWorkUpsertResult[] results = await updater.UpsertAsync([ingest], CancellationToken.None);
|
// VoiceWorkUpsertResult[] results = await updater.UpsertAsync([ingest], CancellationToken.None);
|
||||||
|
|
||||||
int englishVoiceWorkCount = await dbContext.EnglishVoiceWorks.CountAsync(CancellationToken.None);
|
// int englishVoiceWorkCount = await dbContext.EnglishVoiceWorks.CountAsync(CancellationToken.None);
|
||||||
englishVoiceWorkCount.ShouldBe(0);
|
// englishVoiceWorkCount.ShouldBe(0);
|
||||||
|
|
||||||
results.Length.ShouldBe(1);
|
// results.Length.ShouldBe(1);
|
||||||
results.Count(r => r.Status == VoiceWorkUpsertStatus.Inserted).ShouldBe(0);
|
// results.Count(r => r.Status == VoiceWorkUpsertStatus.Inserted).ShouldBe(0);
|
||||||
results.Count(r => r.Status == VoiceWorkUpsertStatus.Updated).ShouldBe(0);
|
// results.Count(r => r.Status == VoiceWorkUpsertStatus.Updated).ShouldBe(0);
|
||||||
results.Count(r => r.Status == VoiceWorkUpsertStatus.Skipped).ShouldBe(1);
|
// results.Count(r => r.Status == VoiceWorkUpsertStatus.Skipped).ShouldBe(1);
|
||||||
results.Sum(r => r.Issues.Count).ShouldBe(1);
|
// results.Sum(r => r.Issues.Count).ShouldBe(1);
|
||||||
|
|
||||||
VoiceWorkUpsertIssue issue = results[0].Issues.ElementAt(0);
|
// VoiceWorkUpsertIssue issue = results[0].Issues.ElementAt(0);
|
||||||
issue.Severity.ShouldBe(VoiceWorkUpsertIssueSeverity.Information);
|
// issue.Severity.ShouldBe(VoiceWorkUpsertIssueSeverity.Information);
|
||||||
issue.Message.ShouldBe("Product title and/or description is not in English");
|
// 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.Common.Time;
|
||||||
using JSMR.Infrastructure.Data;
|
using JSMR.Infrastructure.Data;
|
||||||
using JSMR.Infrastructure.Ingestion;
|
using JSMR.Infrastructure.Ingestion;
|
||||||
|
using JSMR.Tests.Fixtures;
|
||||||
|
using JSMR.Tests.Ingestion.Japanese;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
using NSubstitute;
|
using NSubstitute;
|
||||||
using Shouldly;
|
using Shouldly;
|
||||||
|
|
||||||
namespace JSMR.Tests.Ingestion;
|
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>();
|
public class VoiceWorkIngestionTests(MariaDbContainerFixture container) : IngestionTestsBase(container)
|
||||||
// clock.UtcNow.Returns(new DateTimeOffset(2025, 1, 3, 0, 0, 0, 0, TimeSpan.FromSeconds(0)));
|
{
|
||||||
|
|
||||||
// TokyoTimeProvider timeProvider = new(clock);
|
}
|
||||||
|
|
||||||
// VoiceWorkUpdater updater = new(context, timeProvider);
|
|
||||||
// await updater.UpsertAsync(ingests, CancellationToken.None);
|
|
||||||
|
|
||||||
// // TODO
|
|
||||||
// //context.VoiceWorks.Count().ShouldBe(2);
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
@@ -8,12 +8,13 @@ using Shouldly;
|
|||||||
|
|
||||||
namespace JSMR.Tests.Integration;
|
namespace JSMR.Tests.Integration;
|
||||||
|
|
||||||
public class CircleSearchProviderTests(CircleSearchProviderFixture fixture) : IClassFixture<CircleSearchProviderFixture>
|
public class CircleSearchProviderTests(CircleSearchProviderFixture2 fixture) : IClassFixture<CircleSearchProviderFixture2>
|
||||||
{
|
{
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task Filter_None()
|
public async Task Filter_None()
|
||||||
{
|
{
|
||||||
await using AppDbContext context = fixture.CreateDbContext();
|
//await using AppDbContext context = fixture.CreateDbContext();
|
||||||
|
AppDbContext context = fixture.DbContext!;
|
||||||
CircleSearchProvider provider = new(context);
|
CircleSearchProvider provider = new(context);
|
||||||
|
|
||||||
var options = new SearchOptions<CircleSearchCriteria, CircleSortField>()
|
var options = new SearchOptions<CircleSearchCriteria, CircleSortField>()
|
||||||
@@ -33,7 +34,8 @@ public class CircleSearchProviderTests(CircleSearchProviderFixture fixture) : IC
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Filter_By_Status_Not_Blacklisted()
|
public async Task Filter_By_Status_Not_Blacklisted()
|
||||||
{
|
{
|
||||||
await using AppDbContext context = fixture.CreateDbContext();
|
//await using AppDbContext context = fixture.CreateDbContext();
|
||||||
|
AppDbContext context = fixture.DbContext!;
|
||||||
CircleSearchProvider provider = new(context);
|
CircleSearchProvider provider = new(context);
|
||||||
|
|
||||||
var options = new SearchOptions<CircleSearchCriteria, CircleSortField>()
|
var options = new SearchOptions<CircleSearchCriteria, CircleSortField>()
|
||||||
@@ -54,7 +56,8 @@ public class CircleSearchProviderTests(CircleSearchProviderFixture fixture) : IC
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Filter_By_Status_Favorited()
|
public async Task Filter_By_Status_Favorited()
|
||||||
{
|
{
|
||||||
await using AppDbContext context = fixture.CreateDbContext();
|
//await using AppDbContext context = fixture.CreateDbContext();
|
||||||
|
AppDbContext context = fixture.DbContext!;
|
||||||
CircleSearchProvider provider = new(context);
|
CircleSearchProvider provider = new(context);
|
||||||
|
|
||||||
var options = new SearchOptions<CircleSearchCriteria, CircleSortField>()
|
var options = new SearchOptions<CircleSearchCriteria, CircleSortField>()
|
||||||
@@ -75,7 +78,8 @@ public class CircleSearchProviderTests(CircleSearchProviderFixture fixture) : IC
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Filter_By_Status_Blacklisted()
|
public async Task Filter_By_Status_Blacklisted()
|
||||||
{
|
{
|
||||||
await using AppDbContext context = fixture.CreateDbContext();
|
//await using AppDbContext context = fixture.CreateDbContext();
|
||||||
|
AppDbContext context = fixture.DbContext!;
|
||||||
CircleSearchProvider provider = new(context);
|
CircleSearchProvider provider = new(context);
|
||||||
|
|
||||||
var options = new SearchOptions<CircleSearchCriteria, CircleSortField>()
|
var options = new SearchOptions<CircleSearchCriteria, CircleSortField>()
|
||||||
@@ -96,7 +100,8 @@ public class CircleSearchProviderTests(CircleSearchProviderFixture fixture) : IC
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Filter_By_Status_Spam()
|
public async Task Filter_By_Status_Spam()
|
||||||
{
|
{
|
||||||
await using AppDbContext context = fixture.CreateDbContext();
|
//await using AppDbContext context = fixture.CreateDbContext();
|
||||||
|
AppDbContext context = fixture.DbContext!;
|
||||||
CircleSearchProvider provider = new(context);
|
CircleSearchProvider provider = new(context);
|
||||||
|
|
||||||
var options = new SearchOptions<CircleSearchCriteria, CircleSortField>()
|
var options = new SearchOptions<CircleSearchCriteria, CircleSortField>()
|
||||||
@@ -117,7 +122,8 @@ public class CircleSearchProviderTests(CircleSearchProviderFixture fixture) : IC
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Filter_By_Name_Circle_Name()
|
public async Task Filter_By_Name_Circle_Name()
|
||||||
{
|
{
|
||||||
await using AppDbContext context = fixture.CreateDbContext();
|
//await using AppDbContext context = fixture.CreateDbContext();
|
||||||
|
AppDbContext context = fixture.DbContext!;
|
||||||
CircleSearchProvider provider = new(context);
|
CircleSearchProvider provider = new(context);
|
||||||
|
|
||||||
var options = new SearchOptions<CircleSearchCriteria, CircleSortField>()
|
var options = new SearchOptions<CircleSearchCriteria, CircleSortField>()
|
||||||
@@ -138,7 +144,8 @@ public class CircleSearchProviderTests(CircleSearchProviderFixture fixture) : IC
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Filter_By_Name_Circle_Id()
|
public async Task Filter_By_Name_Circle_Id()
|
||||||
{
|
{
|
||||||
await using AppDbContext context = fixture.CreateDbContext();
|
//await using AppDbContext context = fixture.CreateDbContext();
|
||||||
|
AppDbContext context = fixture.DbContext!;
|
||||||
CircleSearchProvider provider = new(context);
|
CircleSearchProvider provider = new(context);
|
||||||
|
|
||||||
var options = new SearchOptions<CircleSearchCriteria, CircleSortField>()
|
var options = new SearchOptions<CircleSearchCriteria, CircleSortField>()
|
||||||
@@ -159,7 +166,8 @@ public class CircleSearchProviderTests(CircleSearchProviderFixture fixture) : IC
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Sort_By_Name_Descending()
|
public async Task Sort_By_Name_Descending()
|
||||||
{
|
{
|
||||||
await using AppDbContext context = fixture.CreateDbContext();
|
//await using AppDbContext context = fixture.CreateDbContext();
|
||||||
|
AppDbContext context = fixture.DbContext!;
|
||||||
CircleSearchProvider provider = new(context);
|
CircleSearchProvider provider = new(context);
|
||||||
|
|
||||||
var options = new SearchOptions<CircleSearchCriteria, CircleSortField>()
|
var options = new SearchOptions<CircleSearchCriteria, CircleSortField>()
|
||||||
@@ -180,7 +188,8 @@ public class CircleSearchProviderTests(CircleSearchProviderFixture fixture) : IC
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Sort_By_Favorite_Ascending()
|
public async Task Sort_By_Favorite_Ascending()
|
||||||
{
|
{
|
||||||
await using AppDbContext context = fixture.CreateDbContext();
|
//await using AppDbContext context = fixture.CreateDbContext();
|
||||||
|
AppDbContext context = fixture.DbContext!;
|
||||||
CircleSearchProvider provider = new(context);
|
CircleSearchProvider provider = new(context);
|
||||||
|
|
||||||
var options = new SearchOptions<CircleSearchCriteria, CircleSortField>()
|
var options = new SearchOptions<CircleSearchCriteria, CircleSortField>()
|
||||||
@@ -199,7 +208,8 @@ public class CircleSearchProviderTests(CircleSearchProviderFixture fixture) : IC
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Sort_By_Blacklisted_Ascending()
|
public async Task Sort_By_Blacklisted_Ascending()
|
||||||
{
|
{
|
||||||
await using AppDbContext context = fixture.CreateDbContext();
|
//await using AppDbContext context = fixture.CreateDbContext();
|
||||||
|
AppDbContext context = fixture.DbContext!;
|
||||||
CircleSearchProvider provider = new(context);
|
CircleSearchProvider provider = new(context);
|
||||||
|
|
||||||
var options = new SearchOptions<CircleSearchCriteria, CircleSortField>()
|
var options = new SearchOptions<CircleSearchCriteria, CircleSortField>()
|
||||||
@@ -218,7 +228,8 @@ public class CircleSearchProviderTests(CircleSearchProviderFixture fixture) : IC
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Sort_By_Spam_Ascending()
|
public async Task Sort_By_Spam_Ascending()
|
||||||
{
|
{
|
||||||
await using AppDbContext context = fixture.CreateDbContext();
|
//await using AppDbContext context = fixture.CreateDbContext();
|
||||||
|
AppDbContext context = fixture.DbContext!;
|
||||||
CircleSearchProvider provider = new(context);
|
CircleSearchProvider provider = new(context);
|
||||||
|
|
||||||
var options = new SearchOptions<CircleSearchCriteria, CircleSortField>()
|
var options = new SearchOptions<CircleSearchCriteria, CircleSortField>()
|
||||||
|
|||||||
@@ -7,12 +7,13 @@ using Shouldly;
|
|||||||
|
|
||||||
namespace JSMR.Tests.Integration;
|
namespace JSMR.Tests.Integration;
|
||||||
|
|
||||||
public class CreatorSearchProviderTests(CreatorSearchProviderFixture fixture) : IClassFixture<CreatorSearchProviderFixture>
|
public class CreatorSearchProviderTests(CreatorSearchProviderFixture2 fixture) : IClassFixture<CreatorSearchProviderFixture2>
|
||||||
{
|
{
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task Filter_None_Sort_Name_Ascending()
|
public async Task Filter_None_Sort_Name_Ascending()
|
||||||
{
|
{
|
||||||
await using AppDbContext context = fixture.CreateDbContext();
|
//await using AppDbContext context = fixture.CreateDbContext();
|
||||||
|
AppDbContext context = fixture.DbContext!;
|
||||||
CreatorSearchProvider provider = new(context);
|
CreatorSearchProvider provider = new(context);
|
||||||
|
|
||||||
var options = new SearchOptions<CreatorSearchCriteria, CreatorSortField>()
|
var options = new SearchOptions<CreatorSearchCriteria, CreatorSortField>()
|
||||||
@@ -20,7 +21,7 @@ public class CreatorSearchProviderTests(CreatorSearchProviderFixture fixture) :
|
|||||||
SortOptions = [new(CreatorSortField.Name, Application.Common.Search.SortDirection.Ascending)]
|
SortOptions = [new(CreatorSortField.Name, Application.Common.Search.SortDirection.Ascending)]
|
||||||
};
|
};
|
||||||
|
|
||||||
var result = await provider.SearchAsync(options);
|
var result = await provider.SearchAsync(options, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
result.Items.Length.ShouldBe(3);
|
result.Items.Length.ShouldBe(3);
|
||||||
result.TotalItems.ShouldBe(3);
|
result.TotalItems.ShouldBe(3);
|
||||||
@@ -31,7 +32,8 @@ public class CreatorSearchProviderTests(CreatorSearchProviderFixture fixture) :
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Filter_None_Sort_Name_Descending()
|
public async Task Filter_None_Sort_Name_Descending()
|
||||||
{
|
{
|
||||||
await using AppDbContext context = fixture.CreateDbContext();
|
//await using AppDbContext context = fixture.CreateDbContext();
|
||||||
|
AppDbContext context = fixture.DbContext!;
|
||||||
CreatorSearchProvider provider = new(context);
|
CreatorSearchProvider provider = new(context);
|
||||||
|
|
||||||
var options = new SearchOptions<CreatorSearchCriteria, CreatorSortField>()
|
var options = new SearchOptions<CreatorSearchCriteria, CreatorSortField>()
|
||||||
@@ -39,7 +41,7 @@ public class CreatorSearchProviderTests(CreatorSearchProviderFixture fixture) :
|
|||||||
SortOptions = [new(CreatorSortField.Name, Application.Common.Search.SortDirection.Descending)]
|
SortOptions = [new(CreatorSortField.Name, Application.Common.Search.SortDirection.Descending)]
|
||||||
};
|
};
|
||||||
|
|
||||||
var result = await provider.SearchAsync(options);
|
var result = await provider.SearchAsync(options, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
result.Items.Length.ShouldBe(3);
|
result.Items.Length.ShouldBe(3);
|
||||||
result.TotalItems.ShouldBe(3);
|
result.TotalItems.ShouldBe(3);
|
||||||
@@ -50,7 +52,8 @@ public class CreatorSearchProviderTests(CreatorSearchProviderFixture fixture) :
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Filter_None_Sort_Favorite_Descending()
|
public async Task Filter_None_Sort_Favorite_Descending()
|
||||||
{
|
{
|
||||||
await using AppDbContext context = fixture.CreateDbContext();
|
//await using AppDbContext context = fixture.CreateDbContext();
|
||||||
|
AppDbContext context = fixture.DbContext!;
|
||||||
CreatorSearchProvider provider = new(context);
|
CreatorSearchProvider provider = new(context);
|
||||||
|
|
||||||
var options = new SearchOptions<CreatorSearchCriteria, CreatorSortField>()
|
var options = new SearchOptions<CreatorSearchCriteria, CreatorSortField>()
|
||||||
@@ -58,7 +61,7 @@ public class CreatorSearchProviderTests(CreatorSearchProviderFixture fixture) :
|
|||||||
SortOptions = [new(CreatorSortField.Favorite, Application.Common.Search.SortDirection.Ascending)]
|
SortOptions = [new(CreatorSortField.Favorite, Application.Common.Search.SortDirection.Ascending)]
|
||||||
};
|
};
|
||||||
|
|
||||||
var result = await provider.SearchAsync(options);
|
var result = await provider.SearchAsync(options, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
result.Items[0].Name.ShouldBe("John Doe");
|
result.Items[0].Name.ShouldBe("John Doe");
|
||||||
}
|
}
|
||||||
@@ -66,7 +69,8 @@ public class CreatorSearchProviderTests(CreatorSearchProviderFixture fixture) :
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Filter_None_Sort_Blacklisted_Descending()
|
public async Task Filter_None_Sort_Blacklisted_Descending()
|
||||||
{
|
{
|
||||||
await using AppDbContext context = fixture.CreateDbContext();
|
//await using AppDbContext context = fixture.CreateDbContext();
|
||||||
|
AppDbContext context = fixture.DbContext!;
|
||||||
CreatorSearchProvider provider = new(context);
|
CreatorSearchProvider provider = new(context);
|
||||||
|
|
||||||
var options = new SearchOptions<CreatorSearchCriteria, CreatorSortField>()
|
var options = new SearchOptions<CreatorSearchCriteria, CreatorSortField>()
|
||||||
@@ -74,7 +78,7 @@ public class CreatorSearchProviderTests(CreatorSearchProviderFixture fixture) :
|
|||||||
SortOptions = [new(CreatorSortField.Blacklisted, Application.Common.Search.SortDirection.Ascending)]
|
SortOptions = [new(CreatorSortField.Blacklisted, Application.Common.Search.SortDirection.Ascending)]
|
||||||
};
|
};
|
||||||
|
|
||||||
var result = await provider.SearchAsync(options);
|
var result = await provider.SearchAsync(options, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
result.Items[0].Name.ShouldBe("Jane Doe");
|
result.Items[0].Name.ShouldBe("Jane Doe");
|
||||||
}
|
}
|
||||||
@@ -82,7 +86,8 @@ public class CreatorSearchProviderTests(CreatorSearchProviderFixture fixture) :
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Filter_By_Name_Creator_Name()
|
public async Task Filter_By_Name_Creator_Name()
|
||||||
{
|
{
|
||||||
await using AppDbContext context = fixture.CreateDbContext();
|
//await using AppDbContext context = fixture.CreateDbContext();
|
||||||
|
AppDbContext context = fixture.DbContext!;
|
||||||
CreatorSearchProvider provider = new(context);
|
CreatorSearchProvider provider = new(context);
|
||||||
|
|
||||||
var options = new SearchOptions<CreatorSearchCriteria, CreatorSortField>()
|
var options = new SearchOptions<CreatorSearchCriteria, CreatorSortField>()
|
||||||
@@ -93,7 +98,7 @@ public class CreatorSearchProviderTests(CreatorSearchProviderFixture fixture) :
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var result = await provider.SearchAsync(options);
|
var result = await provider.SearchAsync(options, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
result.Items.Length.ShouldBe(1);
|
result.Items.Length.ShouldBe(1);
|
||||||
|
|||||||
@@ -3,20 +3,17 @@ using JSMR.Application.Tags.Queries.Search.Contracts;
|
|||||||
using JSMR.Infrastructure.Data;
|
using JSMR.Infrastructure.Data;
|
||||||
using JSMR.Infrastructure.Data.Repositories.Tags;
|
using JSMR.Infrastructure.Data.Repositories.Tags;
|
||||||
using JSMR.Tests.Fixtures;
|
using JSMR.Tests.Fixtures;
|
||||||
using JSMR.Tests.Ingestion;
|
|
||||||
using Shouldly;
|
using Shouldly;
|
||||||
using System.ComponentModel;
|
|
||||||
|
|
||||||
namespace JSMR.Tests.Integration;
|
namespace JSMR.Tests.Integration;
|
||||||
|
|
||||||
//[Collection("db")]
|
public class TagSearchProviderTests(TagSearchProviderFixture2 fixture) : IClassFixture<TagSearchProviderFixture2>
|
||||||
public class TagSearchProviderTests(TagSearchProviderFixture fixture) : IClassFixture<TagSearchProviderFixture>
|
|
||||||
{
|
{
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task Filter_None_Sort_Name()
|
public async Task Filter_None_Sort_Name()
|
||||||
{
|
{
|
||||||
await using AppDbContext context = fixture.CreateDbContext();
|
//await using AppDbContext context = fixture.CreateDbContext();
|
||||||
//AppDbContext context = fixture.DbContext!;
|
AppDbContext context = fixture.DbContext!;
|
||||||
TagSearchProvider provider = new(context);
|
TagSearchProvider provider = new(context);
|
||||||
|
|
||||||
var options = new SearchOptions<TagSearchCriteria, TagSortField>()
|
var options = new SearchOptions<TagSearchCriteria, TagSortField>()
|
||||||
@@ -24,7 +21,7 @@ public class TagSearchProviderTests(TagSearchProviderFixture fixture) : IClassFi
|
|||||||
SortOptions = [new(TagSortField.Name, Application.Common.Search.SortDirection.Ascending)]
|
SortOptions = [new(TagSortField.Name, Application.Common.Search.SortDirection.Ascending)]
|
||||||
};
|
};
|
||||||
|
|
||||||
var result = await provider.SearchAsync(options);
|
var result = await provider.SearchAsync(options, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
result.Items.Length.ShouldBe(3);
|
result.Items.Length.ShouldBe(3);
|
||||||
result.TotalItems.ShouldBe(3);
|
result.TotalItems.ShouldBe(3);
|
||||||
@@ -35,8 +32,8 @@ public class TagSearchProviderTests(TagSearchProviderFixture fixture) : IClassFi
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Filter_None_Sort_EnglishName()
|
public async Task Filter_None_Sort_EnglishName()
|
||||||
{
|
{
|
||||||
await using AppDbContext context = fixture.CreateDbContext();
|
//await using AppDbContext context = fixture.CreateDbContext();
|
||||||
//AppDbContext context = fixture.DbContext!;
|
AppDbContext context = fixture.DbContext!;
|
||||||
TagSearchProvider provider = new(context);
|
TagSearchProvider provider = new(context);
|
||||||
|
|
||||||
var options = new SearchOptions<TagSearchCriteria, TagSortField>()
|
var options = new SearchOptions<TagSearchCriteria, TagSortField>()
|
||||||
@@ -44,7 +41,7 @@ public class TagSearchProviderTests(TagSearchProviderFixture fixture) : IClassFi
|
|||||||
SortOptions = [new(TagSortField.EnglishName, Application.Common.Search.SortDirection.Ascending)]
|
SortOptions = [new(TagSortField.EnglishName, Application.Common.Search.SortDirection.Ascending)]
|
||||||
};
|
};
|
||||||
|
|
||||||
var result = await provider.SearchAsync(options);
|
var result = await provider.SearchAsync(options, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
result.Items.Length.ShouldBe(3);
|
result.Items.Length.ShouldBe(3);
|
||||||
result.TotalItems.ShouldBe(3);
|
result.TotalItems.ShouldBe(3);
|
||||||
@@ -55,8 +52,8 @@ public class TagSearchProviderTests(TagSearchProviderFixture fixture) : IClassFi
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Filter_By_Name_Tag_Name()
|
public async Task Filter_By_Name_Tag_Name()
|
||||||
{
|
{
|
||||||
await using AppDbContext context = fixture.CreateDbContext();
|
|
||||||
//await using AppDbContext context = fixture.CreateDbContext();
|
//await using AppDbContext context = fixture.CreateDbContext();
|
||||||
|
AppDbContext context = fixture.DbContext!;
|
||||||
TagSearchProvider provider = new(context);
|
TagSearchProvider provider = new(context);
|
||||||
|
|
||||||
var options = new SearchOptions<TagSearchCriteria, TagSortField>()
|
var options = new SearchOptions<TagSearchCriteria, TagSortField>()
|
||||||
@@ -67,7 +64,7 @@ public class TagSearchProviderTests(TagSearchProviderFixture fixture) : IClassFi
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var result = await provider.SearchAsync(options);
|
var result = await provider.SearchAsync(options, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
result.Items.Length.ShouldBe(1);
|
result.Items.Length.ShouldBe(1);
|
||||||
result.TotalItems.ShouldBe(1);
|
result.TotalItems.ShouldBe(1);
|
||||||
@@ -77,8 +74,8 @@ public class TagSearchProviderTests(TagSearchProviderFixture fixture) : IClassFi
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Filter_By_Name_English_Tag_Name()
|
public async Task Filter_By_Name_English_Tag_Name()
|
||||||
{
|
{
|
||||||
await using AppDbContext context = fixture.CreateDbContext();
|
//await using AppDbContext context = fixture.CreateDbContext();
|
||||||
//AppDbContext context = fixture.DbContext!;
|
AppDbContext context = fixture.DbContext!;
|
||||||
TagSearchProvider provider = new(context);
|
TagSearchProvider provider = new(context);
|
||||||
|
|
||||||
var options = new SearchOptions<TagSearchCriteria, TagSortField>()
|
var options = new SearchOptions<TagSearchCriteria, TagSortField>()
|
||||||
@@ -89,7 +86,7 @@ public class TagSearchProviderTests(TagSearchProviderFixture fixture) : IClassFi
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var result = await provider.SearchAsync(options);
|
var result = await provider.SearchAsync(options, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
result.Items.Length.ShouldBe(1);
|
result.Items.Length.ShouldBe(1);
|
||||||
result.TotalItems.ShouldBe(1);
|
result.TotalItems.ShouldBe(1);
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ using Shouldly;
|
|||||||
|
|
||||||
namespace JSMR.Tests.Integration;
|
namespace JSMR.Tests.Integration;
|
||||||
|
|
||||||
public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture) : IClassFixture<VoiceWorkSearchProviderFixture>
|
public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture2 fixture) : IClassFixture<VoiceWorkSearchProviderFixture2>
|
||||||
{
|
{
|
||||||
private static VoiceWorkSearchProvider InitializeVoiceWorkSearchProvider(AppDbContext context)
|
private static VoiceWorkSearchProvider InitializeVoiceWorkSearchProvider(AppDbContext context)
|
||||||
{
|
{
|
||||||
@@ -20,7 +20,8 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Filter_Default()
|
public async Task Filter_Default()
|
||||||
{
|
{
|
||||||
await using AppDbContext context = fixture.CreateDbContext();
|
//await using AppDbContext context = fixture.CreateDbContext();
|
||||||
|
AppDbContext context = fixture.DbContext!;
|
||||||
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
||||||
|
|
||||||
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
||||||
@@ -32,7 +33,7 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var result = await provider.SearchAsync(options);
|
var result = await provider.SearchAsync(options, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
result.Items.Length.ShouldBe(2);
|
result.Items.Length.ShouldBe(2);
|
||||||
result.TotalItems.ShouldBe(2);
|
result.TotalItems.ShouldBe(2);
|
||||||
@@ -43,7 +44,8 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Filter_Upcoming_Favorite()
|
public async Task Filter_Upcoming_Favorite()
|
||||||
{
|
{
|
||||||
await using AppDbContext context = fixture.CreateDbContext();
|
//await using AppDbContext context = fixture.CreateDbContext();
|
||||||
|
AppDbContext context = fixture.DbContext!;
|
||||||
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
||||||
|
|
||||||
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
||||||
@@ -55,7 +57,7 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var result = await provider.SearchAsync(options);
|
var result = await provider.SearchAsync(options, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
result.Items.Length.ShouldBe(1);
|
result.Items.Length.ShouldBe(1);
|
||||||
result.TotalItems.ShouldBe(1);
|
result.TotalItems.ShouldBe(1);
|
||||||
@@ -66,7 +68,8 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Filter_Availble_Blacklisted()
|
public async Task Filter_Availble_Blacklisted()
|
||||||
{
|
{
|
||||||
await using AppDbContext context = fixture.CreateDbContext();
|
//await using AppDbContext context = fixture.CreateDbContext();
|
||||||
|
AppDbContext context = fixture.DbContext!;
|
||||||
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
||||||
|
|
||||||
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
||||||
@@ -78,7 +81,7 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var result = await provider.SearchAsync(options);
|
var result = await provider.SearchAsync(options, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
result.Items.Length.ShouldBe(1);
|
result.Items.Length.ShouldBe(1);
|
||||||
result.TotalItems.ShouldBe(1);
|
result.TotalItems.ShouldBe(1);
|
||||||
@@ -89,7 +92,8 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Filter_Keywords_Basic()
|
public async Task Filter_Keywords_Basic()
|
||||||
{
|
{
|
||||||
await using AppDbContext context = fixture.CreateDbContext();
|
//await using AppDbContext context = fixture.CreateDbContext();
|
||||||
|
AppDbContext context = fixture.DbContext!;
|
||||||
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
||||||
|
|
||||||
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
||||||
@@ -100,7 +104,7 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var result = await provider.SearchAsync(options);
|
var result = await provider.SearchAsync(options, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
result.Items.Length.ShouldBe(3);
|
result.Items.Length.ShouldBe(3);
|
||||||
result.TotalItems.ShouldBe(3);
|
result.TotalItems.ShouldBe(3);
|
||||||
@@ -110,7 +114,8 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Filter_Keywords_Not_Good()
|
public async Task Filter_Keywords_Not_Good()
|
||||||
{
|
{
|
||||||
await using AppDbContext context = fixture.CreateDbContext();
|
//await using AppDbContext context = fixture.CreateDbContext();
|
||||||
|
AppDbContext context = fixture.DbContext!;
|
||||||
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
||||||
|
|
||||||
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
||||||
@@ -121,7 +126,7 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var result = await provider.SearchAsync(options);
|
var result = await provider.SearchAsync(options, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
result.Items.Length.ShouldBe(2);
|
result.Items.Length.ShouldBe(2);
|
||||||
result.TotalItems.ShouldBe(2);
|
result.TotalItems.ShouldBe(2);
|
||||||
@@ -132,7 +137,8 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Filter_Keywords_Dreams_And_Amazing_Or_Favorite()
|
public async Task Filter_Keywords_Dreams_And_Amazing_Or_Favorite()
|
||||||
{
|
{
|
||||||
await using AppDbContext context = fixture.CreateDbContext();
|
//await using AppDbContext context = fixture.CreateDbContext();
|
||||||
|
AppDbContext context = fixture.DbContext!;
|
||||||
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
||||||
|
|
||||||
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
||||||
@@ -143,7 +149,7 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var result = await provider.SearchAsync(options);
|
var result = await provider.SearchAsync(options, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
result.Items.Length.ShouldBe(2);
|
result.Items.Length.ShouldBe(2);
|
||||||
result.TotalItems.ShouldBe(2);
|
result.TotalItems.ShouldBe(2);
|
||||||
@@ -157,7 +163,8 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Filter_Keywords_Phrase_Search()
|
public async Task Filter_Keywords_Phrase_Search()
|
||||||
{
|
{
|
||||||
await using AppDbContext context = fixture.CreateDbContext();
|
//await using AppDbContext context = fixture.CreateDbContext();
|
||||||
|
AppDbContext context = fixture.DbContext!;
|
||||||
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
||||||
|
|
||||||
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
||||||
@@ -168,7 +175,7 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var result = await provider.SearchAsync(options);
|
var result = await provider.SearchAsync(options, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
result.Items.Length.ShouldBe(1);
|
result.Items.Length.ShouldBe(1);
|
||||||
result.TotalItems.ShouldBe(1);
|
result.TotalItems.ShouldBe(1);
|
||||||
@@ -178,7 +185,8 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Filter_Tags_Favorite_Exclude_Blacklisted()
|
public async Task Filter_Tags_Favorite_Exclude_Blacklisted()
|
||||||
{
|
{
|
||||||
await using AppDbContext context = fixture.CreateDbContext();
|
//await using AppDbContext context = fixture.CreateDbContext();
|
||||||
|
AppDbContext context = fixture.DbContext!;
|
||||||
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
||||||
|
|
||||||
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
||||||
@@ -189,7 +197,7 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var result = await provider.SearchAsync(options);
|
var result = await provider.SearchAsync(options, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
result.Items.Length.ShouldBe(1);
|
result.Items.Length.ShouldBe(1);
|
||||||
result.TotalItems.ShouldBe(1);
|
result.TotalItems.ShouldBe(1);
|
||||||
@@ -203,7 +211,8 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Filter_Tags_Favorite_Include_Blacklisted()
|
public async Task Filter_Tags_Favorite_Include_Blacklisted()
|
||||||
{
|
{
|
||||||
await using AppDbContext context = fixture.CreateDbContext();
|
//await using AppDbContext context = fixture.CreateDbContext();
|
||||||
|
AppDbContext context = fixture.DbContext!;
|
||||||
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
||||||
|
|
||||||
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
||||||
@@ -214,7 +223,7 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var result = await provider.SearchAsync(options);
|
var result = await provider.SearchAsync(options, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
result.Items.Length.ShouldBe(2);
|
result.Items.Length.ShouldBe(2);
|
||||||
result.TotalItems.ShouldBe(2);
|
result.TotalItems.ShouldBe(2);
|
||||||
@@ -228,7 +237,8 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Filter_Tags_Not_Blacklisted()
|
public async Task Filter_Tags_Not_Blacklisted()
|
||||||
{
|
{
|
||||||
await using AppDbContext context = fixture.CreateDbContext();
|
//await using AppDbContext context = fixture.CreateDbContext();
|
||||||
|
AppDbContext context = fixture.DbContext!;
|
||||||
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
||||||
|
|
||||||
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
||||||
@@ -239,7 +249,7 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var result = await provider.SearchAsync(options);
|
var result = await provider.SearchAsync(options, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
result.Items.Length.ShouldBe(4);
|
result.Items.Length.ShouldBe(4);
|
||||||
result.TotalItems.ShouldBe(4);
|
result.TotalItems.ShouldBe(4);
|
||||||
@@ -253,7 +263,8 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Filter_Tags_Blacklisted()
|
public async Task Filter_Tags_Blacklisted()
|
||||||
{
|
{
|
||||||
await using AppDbContext context = fixture.CreateDbContext();
|
//await using AppDbContext context = fixture.CreateDbContext();
|
||||||
|
AppDbContext context = fixture.DbContext!;
|
||||||
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
||||||
|
|
||||||
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
||||||
@@ -264,7 +275,7 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var result = await provider.SearchAsync(options);
|
var result = await provider.SearchAsync(options, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
result.Items.Length.ShouldBe(1);
|
result.Items.Length.ShouldBe(1);
|
||||||
result.TotalItems.ShouldBe(1);
|
result.TotalItems.ShouldBe(1);
|
||||||
@@ -278,7 +289,8 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Filter_TagIds_Or()
|
public async Task Filter_TagIds_Or()
|
||||||
{
|
{
|
||||||
await using AppDbContext context = fixture.CreateDbContext();
|
//await using AppDbContext context = fixture.CreateDbContext();
|
||||||
|
AppDbContext context = fixture.DbContext!;
|
||||||
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
||||||
|
|
||||||
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
||||||
@@ -290,7 +302,7 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var result = await provider.SearchAsync(options);
|
var result = await provider.SearchAsync(options, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
result.Items.Length.ShouldBe(2);
|
result.Items.Length.ShouldBe(2);
|
||||||
result.TotalItems.ShouldBe(2);
|
result.TotalItems.ShouldBe(2);
|
||||||
@@ -304,7 +316,8 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Filter_TagIds_And()
|
public async Task Filter_TagIds_And()
|
||||||
{
|
{
|
||||||
await using AppDbContext context = fixture.CreateDbContext();
|
//await using AppDbContext context = fixture.CreateDbContext();
|
||||||
|
AppDbContext context = fixture.DbContext!;
|
||||||
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
||||||
|
|
||||||
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
||||||
@@ -316,7 +329,7 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var result = await provider.SearchAsync(options);
|
var result = await provider.SearchAsync(options, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
result.Items.Length.ShouldBe(1);
|
result.Items.Length.ShouldBe(1);
|
||||||
result.TotalItems.ShouldBe(1);
|
result.TotalItems.ShouldBe(1);
|
||||||
@@ -330,7 +343,8 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Filter_Creators_Favorite_Exclude_Blacklisted()
|
public async Task Filter_Creators_Favorite_Exclude_Blacklisted()
|
||||||
{
|
{
|
||||||
await using AppDbContext context = fixture.CreateDbContext();
|
//await using AppDbContext context = fixture.CreateDbContext();
|
||||||
|
AppDbContext context = fixture.DbContext!;
|
||||||
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
||||||
|
|
||||||
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
||||||
@@ -341,7 +355,7 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var result = await provider.SearchAsync(options);
|
var result = await provider.SearchAsync(options, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
result.Items.Length.ShouldBe(2);
|
result.Items.Length.ShouldBe(2);
|
||||||
result.TotalItems.ShouldBe(2);
|
result.TotalItems.ShouldBe(2);
|
||||||
@@ -355,7 +369,8 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Filter_Creators_Favorite_Include_Blacklisted()
|
public async Task Filter_Creators_Favorite_Include_Blacklisted()
|
||||||
{
|
{
|
||||||
await using AppDbContext context = fixture.CreateDbContext();
|
//await using AppDbContext context = fixture.CreateDbContext();
|
||||||
|
AppDbContext context = fixture.DbContext!;
|
||||||
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
||||||
|
|
||||||
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
||||||
@@ -366,7 +381,7 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var result = await provider.SearchAsync(options);
|
var result = await provider.SearchAsync(options, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
result.Items.Length.ShouldBe(3);
|
result.Items.Length.ShouldBe(3);
|
||||||
result.TotalItems.ShouldBe(3);
|
result.TotalItems.ShouldBe(3);
|
||||||
@@ -380,7 +395,8 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Filter_Creators_Not_Blacklisted()
|
public async Task Filter_Creators_Not_Blacklisted()
|
||||||
{
|
{
|
||||||
await using AppDbContext context = fixture.CreateDbContext();
|
//await using AppDbContext context = fixture.CreateDbContext();
|
||||||
|
AppDbContext context = fixture.DbContext!;
|
||||||
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
||||||
|
|
||||||
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
||||||
@@ -391,7 +407,7 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var result = await provider.SearchAsync(options);
|
var result = await provider.SearchAsync(options, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
result.Items.Length.ShouldBe(4);
|
result.Items.Length.ShouldBe(4);
|
||||||
result.TotalItems.ShouldBe(4);
|
result.TotalItems.ShouldBe(4);
|
||||||
@@ -405,7 +421,8 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Filter_Creators_Blacklisted()
|
public async Task Filter_Creators_Blacklisted()
|
||||||
{
|
{
|
||||||
await using AppDbContext context = fixture.CreateDbContext();
|
//await using AppDbContext context = fixture.CreateDbContext();
|
||||||
|
AppDbContext context = fixture.DbContext!;
|
||||||
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
||||||
|
|
||||||
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
||||||
@@ -416,7 +433,7 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var result = await provider.SearchAsync(options);
|
var result = await provider.SearchAsync(options, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
result.Items.Length.ShouldBe(1);
|
result.Items.Length.ShouldBe(1);
|
||||||
result.TotalItems.ShouldBe(1);
|
result.TotalItems.ShouldBe(1);
|
||||||
@@ -430,7 +447,8 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Filter_CreatorIds_Or()
|
public async Task Filter_CreatorIds_Or()
|
||||||
{
|
{
|
||||||
await using AppDbContext context = fixture.CreateDbContext();
|
//await using AppDbContext context = fixture.CreateDbContext();
|
||||||
|
AppDbContext context = fixture.DbContext!;
|
||||||
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
||||||
|
|
||||||
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
||||||
@@ -442,7 +460,7 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var result = await provider.SearchAsync(options);
|
var result = await provider.SearchAsync(options, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
result.Items.Length.ShouldBe(3);
|
result.Items.Length.ShouldBe(3);
|
||||||
result.TotalItems.ShouldBe(3);
|
result.TotalItems.ShouldBe(3);
|
||||||
@@ -456,7 +474,8 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Filter_CreatorIds_And()
|
public async Task Filter_CreatorIds_And()
|
||||||
{
|
{
|
||||||
await using AppDbContext context = fixture.CreateDbContext();
|
//await using AppDbContext context = fixture.CreateDbContext();
|
||||||
|
AppDbContext context = fixture.DbContext!;
|
||||||
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
||||||
|
|
||||||
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
||||||
@@ -468,7 +487,7 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var result = await provider.SearchAsync(options);
|
var result = await provider.SearchAsync(options, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
result.Items.Length.ShouldBe(1);
|
result.Items.Length.ShouldBe(1);
|
||||||
result.TotalItems.ShouldBe(1);
|
result.TotalItems.ShouldBe(1);
|
||||||
@@ -482,7 +501,8 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Sort_By_Release_Date_Ascending()
|
public async Task Sort_By_Release_Date_Ascending()
|
||||||
{
|
{
|
||||||
await using AppDbContext context = fixture.CreateDbContext();
|
//await using AppDbContext context = fixture.CreateDbContext();
|
||||||
|
AppDbContext context = fixture.DbContext!;
|
||||||
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
||||||
|
|
||||||
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
||||||
@@ -493,7 +513,7 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
var result = await provider.SearchAsync(options);
|
var result = await provider.SearchAsync(options, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
result.Items
|
result.Items
|
||||||
.Select(item => item.ProductId)
|
.Select(item => item.ProductId)
|
||||||
@@ -503,7 +523,8 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Sort_By_Release_Date_Descending()
|
public async Task Sort_By_Release_Date_Descending()
|
||||||
{
|
{
|
||||||
await using AppDbContext context = fixture.CreateDbContext();
|
//await using AppDbContext context = fixture.CreateDbContext();
|
||||||
|
AppDbContext context = fixture.DbContext!;
|
||||||
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
||||||
|
|
||||||
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
||||||
@@ -514,7 +535,7 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
var result = await provider.SearchAsync(options);
|
var result = await provider.SearchAsync(options, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
result.Items
|
result.Items
|
||||||
.Select(item => item.ProductId)
|
.Select(item => item.ProductId)
|
||||||
@@ -524,7 +545,8 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Sort_By_Downloads_Ascending()
|
public async Task Sort_By_Downloads_Ascending()
|
||||||
{
|
{
|
||||||
await using AppDbContext context = fixture.CreateDbContext();
|
//await using AppDbContext context = fixture.CreateDbContext();
|
||||||
|
AppDbContext context = fixture.DbContext!;
|
||||||
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
||||||
|
|
||||||
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
||||||
@@ -535,7 +557,7 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
var result = await provider.SearchAsync(options);
|
var result = await provider.SearchAsync(options, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
result.Items
|
result.Items
|
||||||
.Select(item => item.ProductId)
|
.Select(item => item.ProductId)
|
||||||
@@ -545,7 +567,8 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Sort_By_Downloads_Descending()
|
public async Task Sort_By_Downloads_Descending()
|
||||||
{
|
{
|
||||||
await using AppDbContext context = fixture.CreateDbContext();
|
//await using AppDbContext context = fixture.CreateDbContext();
|
||||||
|
AppDbContext context = fixture.DbContext!;
|
||||||
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
||||||
|
|
||||||
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
||||||
@@ -556,7 +579,7 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
var result = await provider.SearchAsync(options);
|
var result = await provider.SearchAsync(options, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
result.Items
|
result.Items
|
||||||
.Select(item => item.ProductId)
|
.Select(item => item.ProductId)
|
||||||
@@ -566,7 +589,8 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Sort_By_WishlistCount_Ascending()
|
public async Task Sort_By_WishlistCount_Ascending()
|
||||||
{
|
{
|
||||||
await using AppDbContext context = fixture.CreateDbContext();
|
//await using AppDbContext context = fixture.CreateDbContext();
|
||||||
|
AppDbContext context = fixture.DbContext!;
|
||||||
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
||||||
|
|
||||||
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
||||||
@@ -577,7 +601,7 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
var result = await provider.SearchAsync(options);
|
var result = await provider.SearchAsync(options, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
result.Items
|
result.Items
|
||||||
.Select(item => item.ProductId)
|
.Select(item => item.ProductId)
|
||||||
@@ -587,7 +611,8 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Sort_By_WishlistCount_Descending()
|
public async Task Sort_By_WishlistCount_Descending()
|
||||||
{
|
{
|
||||||
await using AppDbContext context = fixture.CreateDbContext();
|
//await using AppDbContext context = fixture.CreateDbContext();
|
||||||
|
AppDbContext context = fixture.DbContext!;
|
||||||
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
||||||
|
|
||||||
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
||||||
@@ -598,7 +623,7 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
var result = await provider.SearchAsync(options);
|
var result = await provider.SearchAsync(options, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
result.Items
|
result.Items
|
||||||
.Select(item => item.ProductId)
|
.Select(item => item.ProductId)
|
||||||
@@ -608,7 +633,8 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Sort_By_StarRating_Ascending()
|
public async Task Sort_By_StarRating_Ascending()
|
||||||
{
|
{
|
||||||
await using AppDbContext context = fixture.CreateDbContext();
|
//await using AppDbContext context = fixture.CreateDbContext();
|
||||||
|
AppDbContext context = fixture.DbContext!;
|
||||||
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
||||||
|
|
||||||
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
||||||
@@ -619,7 +645,7 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
var result = await provider.SearchAsync(options);
|
var result = await provider.SearchAsync(options, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
result.Items
|
result.Items
|
||||||
.Select(item => item.ProductId)
|
.Select(item => item.ProductId)
|
||||||
@@ -629,7 +655,8 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Sort_By_StarRating_Descending()
|
public async Task Sort_By_StarRating_Descending()
|
||||||
{
|
{
|
||||||
await using AppDbContext context = fixture.CreateDbContext();
|
//await using AppDbContext context = fixture.CreateDbContext();
|
||||||
|
AppDbContext context = fixture.DbContext!;
|
||||||
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
||||||
|
|
||||||
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
||||||
@@ -640,7 +667,7 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
var result = await provider.SearchAsync(options);
|
var result = await provider.SearchAsync(options, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
result.Items
|
result.Items
|
||||||
.Select(item => item.ProductId)
|
.Select(item => item.ProductId)
|
||||||
@@ -650,7 +677,8 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Filter_Release_Date_Range()
|
public async Task Filter_Release_Date_Range()
|
||||||
{
|
{
|
||||||
await using AppDbContext context = fixture.CreateDbContext();
|
//await using AppDbContext context = fixture.CreateDbContext();
|
||||||
|
AppDbContext context = fixture.DbContext!;
|
||||||
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
||||||
|
|
||||||
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
||||||
@@ -662,7 +690,7 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var result = await provider.SearchAsync(options);
|
var result = await provider.SearchAsync(options, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
result.Items
|
result.Items
|
||||||
.OrderBy(item => item.ProductId)
|
.OrderBy(item => item.ProductId)
|
||||||
@@ -673,7 +701,8 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Filter_Downloads_Range()
|
public async Task Filter_Downloads_Range()
|
||||||
{
|
{
|
||||||
await using AppDbContext context = fixture.CreateDbContext();
|
//await using AppDbContext context = fixture.CreateDbContext();
|
||||||
|
AppDbContext context = fixture.DbContext!;
|
||||||
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
||||||
|
|
||||||
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
||||||
@@ -685,7 +714,7 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var result = await provider.SearchAsync(options);
|
var result = await provider.SearchAsync(options, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
result.Items
|
result.Items
|
||||||
.OrderBy(item => item.ProductId)
|
.OrderBy(item => item.ProductId)
|
||||||
@@ -696,7 +725,8 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Filter_Favorite()
|
public async Task Filter_Favorite()
|
||||||
{
|
{
|
||||||
await using AppDbContext context = fixture.CreateDbContext();
|
//await using AppDbContext context = fixture.CreateDbContext();
|
||||||
|
AppDbContext context = fixture.DbContext!;
|
||||||
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
VoiceWorkSearchProvider provider = InitializeVoiceWorkSearchProvider(context);
|
||||||
|
|
||||||
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
var options = new SearchOptions<VoiceWorkSearchCriteria, VoiceWorkSortField>()
|
||||||
@@ -707,7 +737,7 @@ public class VoiceWorkSearchProviderTests(VoiceWorkSearchProviderFixture fixture
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var result = await provider.SearchAsync(options);
|
var result = await provider.SearchAsync(options, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
result.Items
|
result.Items
|
||||||
.OrderBy(item => item.ProductId)
|
.OrderBy(item => item.ProductId)
|
||||||
|
|||||||
@@ -30,12 +30,12 @@
|
|||||||
<PackageReference Include="Shouldly" Version="4.3.0" />
|
<PackageReference Include="Shouldly" Version="4.3.0" />
|
||||||
<PackageReference Include="Testcontainers" Version="4.8.1" />
|
<PackageReference Include="Testcontainers" Version="4.8.1" />
|
||||||
<PackageReference Include="Testcontainers.MariaDb" Version="4.8.1" />
|
<PackageReference Include="Testcontainers.MariaDb" Version="4.8.1" />
|
||||||
<PackageReference Include="Testcontainers.Xunit" Version="4.8.1" />
|
<PackageReference Include="Testcontainers.XunitV3" Version="4.8.1" />
|
||||||
<PackageReference Include="xunit" Version="2.9.3" />
|
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
|
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
<PackageReference Include="xunit.v3" Version="3.1.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
Reference in New Issue
Block a user