Added initial test cases. Fixed circle search provider logic.
This commit is contained in:
45
JSMR.Tests/Integration/Seed.cs
Normal file
45
JSMR.Tests/Integration/Seed.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using JSMR.Domain.Entities;
|
||||
using JSMR.Infrastructure.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace JSMR.Tests.Integration;
|
||||
|
||||
public static class Seed
|
||||
{
|
||||
public static async Task SeedBasicTagsAsync(AppDbContext context)
|
||||
{
|
||||
if (await context.Tags.AnyAsync())
|
||||
return;
|
||||
|
||||
context.Tags.AddRange(
|
||||
new() { TagId = 1, Name = "OL", Favorite = false, Blacklisted = false },
|
||||
new() { TagId = 2, Name = "ほのぼの", Favorite = true, Blacklisted = false },
|
||||
new() { TagId = 3, Name = "ツンデレ", Favorite = false, Blacklisted = true }
|
||||
);
|
||||
|
||||
context.EnglishTags.AddRange(
|
||||
new() { EnglishTagId = 1, TagId = 1, Name = "Office Lady" },
|
||||
new() { EnglishTagId = 2, TagId = 2, Name = "Heartwarming" },
|
||||
new() { EnglishTagId = 3, TagId = 3, Name = "Tsundere" }
|
||||
);
|
||||
|
||||
await context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
public static async Task SeedCirclesWithWorksAsync(AppDbContext context)
|
||||
{
|
||||
var c1 = new Circle { Name = "Circle A", MakerId = "mk001", Favorite = false, Blacklisted = false, Spam = false };
|
||||
var c2 = new Circle { Name = "Circle B", MakerId = "mk002", Favorite = true, Blacklisted = false, Spam = false };
|
||||
context.Circles.AddRange(c1, c2);
|
||||
|
||||
await context.SaveChangesAsync();
|
||||
|
||||
context.VoiceWorks.AddRange(
|
||||
new VoiceWork { CircleId = c1.CircleId, ProductId = "R-1", ProductName = "Work 1", Downloads = 100, SalesDate = new DateTime(2024, 1, 1), HasImage = true },
|
||||
new VoiceWork { CircleId = c1.CircleId, ProductId = "R-10", ProductName = "Work 10", Downloads = 50, SalesDate = new DateTime(2024, 2, 1), HasImage = false },
|
||||
new VoiceWork { CircleId = c2.CircleId, ProductId = "R-2", ProductName = "Work 2", Downloads = 200, SalesDate = new DateTime(2024, 3, 1), HasImage = true }
|
||||
);
|
||||
|
||||
await context.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user