forked from gongxuegit/tiku-backend.net
feat: establish dotnet engineering foundation
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System.Net;
|
||||
using System.Net.Http.Json;
|
||||
using System.Text.Json;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Tiku.Api.Contracts;
|
||||
using Tiku.Application.Auth;
|
||||
@@ -93,6 +94,21 @@ public sealed class TenantCommerceEndpointTests
|
||||
Assert.Equal(HttpStatusCode.OK, accountResponse.StatusCode);
|
||||
Assert.Equal(HttpStatusCode.OK, accountsResponse.StatusCode);
|
||||
Assert.Contains("wechat_pay", await accountsResponse.Content.ReadAsStringAsync(), StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
using var scope = factory.Services.CreateScope();
|
||||
var dbContext = scope.ServiceProvider.GetRequiredService<TikuDbContext>();
|
||||
var storedSecret = await dbContext.TenantSecrets
|
||||
.AsNoTracking()
|
||||
.SingleAsync(item => item.TenantId == seed.TenantId);
|
||||
var configService = scope.ServiceProvider.GetRequiredService<IPaymentProviderConfigService>();
|
||||
var resolvedAccount = await configService.GetActiveAccountAsync(seed.TenantId, "wechat_pay");
|
||||
|
||||
Assert.Equal("development-v1", storedSecret.EncryptionKeyId);
|
||||
Assert.NotEmpty(storedSecret.EncryptedPayload);
|
||||
Assert.Equal(12, storedSecret.EncryptionNonce.Length);
|
||||
Assert.Equal(16, storedSecret.EncryptionTag.Length);
|
||||
Assert.Equal("pem", resolvedAccount.SecretPayload.GetProperty("privateKey").GetString());
|
||||
Assert.Equal("v3", resolvedAccount.SecretPayload.GetProperty("apiV3Key").GetString());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
Reference in New Issue
Block a user