using ZB.MOM.WW.GalaxyRepository;
using ZB.MOM.WW.GalaxyRepository.Grpc;
namespace ZB.MOM.WW.GalaxyRepository.Tests;
///
/// GalaxyRepository-001 (scadaproj#41): the per-entry filter memo was unbounded, so a client
/// issuing distinct tag_name_glob values (*, **, ...) retained one full
/// result list per glob until the next Galaxy deploy. The memo must stay capped.
///
public sealed class ProjectionMemoBoundTests
{
private const int DistinctFilters = 500;
[Fact]
public void DiscoverHierarchy_memo_is_bounded_under_distinct_client_globs()
{
GalaxyHierarchyCacheEntry entry = CreateEntry();
for (int i = 1; i <= DistinctFilters; i++)
{
GalaxyHierarchyProjector.Project(entry, new DiscoverHierarchyRequest { TagNameGlob = new string('*', i) }, null, 0, 1);
}
Assert.InRange(GalaxyHierarchyProjector.MemoCount(entry), 1, ProjectionMemo