feat(templates): GetTemplateStubsAsync untracked identity/edge projection

This commit is contained in:
Joseph Doherty
2026-10-22 06:06:27 -04:00
parent 15c9de0f4a
commit 6bcca4b344
4 changed files with 57 additions and 0 deletions
@@ -31,6 +31,27 @@ public class TemplateEngineRepositoryTests : IDisposable
_context.Dispose();
}
/// <summary>Verifies the stub projection carries identity and edges and leaves nothing tracked.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task GetTemplateStubs_ProjectsEdgesUntrackedOrderedByName()
{
var baseT = new Template("Base");
_context.Templates.Add(baseT);
await _context.SaveChangesAsync();
_context.Templates.Add(new Template("Alpha") { ParentTemplateId = baseT.Id });
await _context.SaveChangesAsync();
_context.ChangeTracker.Clear();
var stubs = await _repository.GetTemplateStubsAsync();
Assert.Equal(new[] { "Alpha", "Base" }, stubs.Select(s => s.Name));
Assert.Equal(baseT.Id, stubs[0].ParentTemplateId);
Assert.Null(stubs[1].ParentTemplateId);
Assert.False(stubs[0].IsDerived);
Assert.Empty(_context.ChangeTracker.Entries());
}
/// <summary>Verifies that the topology page is bounded, filtered and returned untracked.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]