31 lines
1012 B
C#
31 lines
1012 B
C#
using FluentAssertions;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Workflow.Domain.Entities;
|
|
using Xunit;
|
|
|
|
namespace BuildFlow.Workflow.Tests.Performance;
|
|
|
|
/// <summary>表单数据导出 keyset 查询的 EF 索引模型测试。</summary>
|
|
public class FormDataExportIndexTests
|
|
{
|
|
[Fact]
|
|
public void FormDataShouldHaveExportKeysetCompositeIndex()
|
|
{
|
|
var options = new DbContextOptionsBuilder<WorkflowDbContext>()
|
|
.UseInMemoryDatabase($"form-data-export-index-{Guid.NewGuid():N}")
|
|
.Options;
|
|
using var db = new WorkflowDbContext(options);
|
|
var entity = db.Model.FindEntityType(typeof(FormData));
|
|
|
|
entity.Should().NotBeNull();
|
|
entity!.GetIndexes().Should().Contain(index => index.Properties
|
|
.Select(property => property.Name)
|
|
.SequenceEqual(new[]
|
|
{
|
|
nameof(FormData.FormDefinitionId),
|
|
nameof(FormData.CreatedAt),
|
|
nameof(FormData.Id),
|
|
}));
|
|
}
|
|
}
|