feat(templates): GetTemplateStubsAsync untracked identity/edge projection
This commit is contained in:
+21
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user