fix(configdb): InstanceLocator single untracked projected join (review 2026-10-21 08/P7)
This commit is contained in:
@@ -1486,6 +1486,24 @@ public class InstanceLocatorTests : IDisposable
|
||||
Assert.Equal("SITE-001", result);
|
||||
}
|
||||
|
||||
/// <summary>The lookup must not track entities (single untracked projection, review 08/P7).</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task GetSiteIdForInstance_DoesNotTrackEntities()
|
||||
{
|
||||
var site = new Site("Site1", "SITE-001");
|
||||
var template = new Template("T1");
|
||||
_context.Sites.Add(site);
|
||||
_context.Templates.Add(template);
|
||||
await _context.SaveChangesAsync();
|
||||
_context.Instances.Add(new Instance("Pump1") { SiteId = site.Id, TemplateId = template.Id });
|
||||
await _context.SaveChangesAsync();
|
||||
_context.ChangeTracker.Clear();
|
||||
|
||||
Assert.Equal("SITE-001", await _locator.GetSiteIdForInstanceAsync("Pump1"));
|
||||
Assert.Empty(_context.ChangeTracker.Entries());
|
||||
}
|
||||
|
||||
/// <summary>Verifies that getting the site id for a missing instance returns null.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
|
||||
Reference in New Issue
Block a user