暂时提交

This commit is contained in:
chfei committed 2026-10-29 16:34:25 +08:00
1 parent 5d017740c6
commit b35f816a87
7 files changed
+96 -2

No files matched your search

@@ -5,6 +5,9 @@ using MAX.Framework.Security;
using Microsoft.Extensions.Configuration;
using Store.Shops.Entities;
using Store.Shops.Services;
using Store.Shops.Repositories;
using Store.Users.Entities;
using YourNamespace;
using Store.Users.Contracts;
using Store.Users.Contracts.Dtos;
using Store.Users.Contracts.Enums;
@@ -28,6 +31,7 @@ internal sealed class ShopTestContext : IDisposable, ICurrentUser, IUserQuerySer
public StubHttp Handler { get; } = new();
public PddTokenClient Gateway { get; }
public ShopManagementService Service { get; }
public IShopRepository Repository { get; }
public IConfiguration Configuration { get; } = new ConfigurationBuilder().AddInMemoryCollection(new Dictionary<string, string?>
{
["Shops:PddClients:0:ClientId"] = "test-client",
@@ -45,6 +49,11 @@ internal sealed class ShopTestContext : IDisposable, ICurrentUser, IUserQuerySer
Db.CodeFirst.ConfigEntity<ShopApiAuthEntity>(e => e.Name("shop_auth"));
Db.CodeFirst.ConfigEntity<ShopProductQuotaEntity>(e => e.Name("shop_quota"));
Db.CodeFirst.SyncStructure(typeof(PddShopEntity), typeof(WeidianShopEntity), typeof(ShopApiAuthEntity), typeof(ShopProductQuotaEntity));
Db.CodeFirst.ConfigEntity<ShopEntity>(e => e.Name("shops"));
Db.CodeFirst.ConfigEntity<ShopExpireEntity>(e => e.Name("shop_expirations"));
Db.CodeFirst.SyncStructure(typeof(ShopEntity), typeof(ShopExpireEntity));
Repository = (IShopRepository)Activator.CreateInstance(
typeof(ShopService).Assembly.GetType("Store.Shops.Repositories.ShopRepository", true)!, Db)!;
Gateway = new(new HttpClient(Handler));
Service = new(Db, this, this, Configuration, Gateway);
}