feat: establish dotnet engineering foundation

This commit is contained in:
2026-07-27 15:00:14 +08:00
parent 60a376ea0b
commit 28e9a9fa41
36 changed files with 17301 additions and 89 deletions

View File

@@ -1,6 +1,7 @@
using System.Net;
using System.Text.Json;
using Tiku.Domain.Common;
using Tiku.Domain.Catalog;
using Tiku.Domain.Content;
using Tiku.Domain.QuestionBanks;
using Tiku.Domain.Tenancy;
@@ -17,6 +18,7 @@ public sealed class ContentNavigationEndpointTests
await using var factory = new ApiTestFactory();
await factory.SeedAsync(
Tenant(tenantId, "master"),
new Region { Id = regionId, TenantId = tenantId, Name = "测试地区" },
new ContentEntry
{
Id = Guid.NewGuid(),
@@ -193,23 +195,6 @@ public sealed class ContentNavigationEndpointTests
Status = ContentStatus.Active
},
new Question
{
Id = publishedQuestionId,
TenantId = tenantId,
PrimaryCollectionId = collectionId,
Type = "choice",
TypeLabel = "单选题",
Status = QuestionStatus.Published,
CurrentVersionId = versionId
},
new QuestionVersion
{
Id = versionId,
TenantId = tenantId,
QuestionId = publishedQuestionId,
Content = "题干"
},
new Question
{
Id = archivedQuestionId,
TenantId = tenantId,
@@ -218,15 +203,6 @@ public sealed class ContentNavigationEndpointTests
Status = QuestionStatus.Archived
},
new QuestionCollectionItem
{
Id = Guid.NewGuid(),
TenantId = tenantId,
CollectionId = collectionId,
QuestionId = publishedQuestionId,
SortOrder = 1,
Score = 2
},
new QuestionCollectionItem
{
Id = Guid.NewGuid(),
TenantId = tenantId,
@@ -234,6 +210,32 @@ public sealed class ContentNavigationEndpointTests
QuestionId = archivedQuestionId,
SortOrder = 2
});
await factory.SeedQuestionWithVersionAsync(
new Question
{
Id = publishedQuestionId,
TenantId = tenantId,
PrimaryCollectionId = collectionId,
Type = "choice",
TypeLabel = "单选题",
Status = QuestionStatus.Published
},
new QuestionVersion
{
Id = versionId,
TenantId = tenantId,
QuestionId = publishedQuestionId,
Content = "题干"
});
await factory.SeedAsync(new QuestionCollectionItem
{
Id = Guid.NewGuid(),
TenantId = tenantId,
CollectionId = collectionId,
QuestionId = publishedQuestionId,
SortOrder = 1,
Score = 2
});
using var client = factory.CreateClient();
using var response = await client.GetAsync($"/api/catalog/question-collections/questions?tenantCode=master&collectionId={collectionId}");