using Admin.NET.Plugin.AiDOP.Dto.S8; using Admin.NET.Plugin.AiDOP.Job; using Admin.NET.Plugin.AiDOP.Service.S8; using Admin.NET.Plugin.AiDOP.Service.S8.Rules; using Xunit; namespace Admin.NET.Plugin.AiDOP.Tests.S8; public class S8TenantIsolationContractTests { [Fact] public void AutoExceptionCreation_RequiresExplicitTenantAndFactory() { Assert.NotNull(typeof(S8ManualReportService).GetMethod( nameof(S8ManualReportService.CreateFromWatchAsync), [typeof(long), typeof(long), typeof(S8WatchHitResult)])); Assert.NotNull(typeof(S8ManualReportService).GetMethod( nameof(S8ManualReportService.CreateFromHitAsync), [typeof(long), typeof(long), typeof(S8RuleHit)])); } [Fact] public void SchedulerServices_DiscoverValidTenantScopes() { Assert.NotNull(typeof(S8WatchSchedulerService).GetMethod( nameof(S8WatchSchedulerService.ListEnabledScopesAsync))); Assert.NotNull(typeof(S8ActiveFlowWatchService).GetMethod( nameof(S8ActiveFlowWatchService.ListActiveScopesAsync))); } [Fact] public void ManualReport_ResolvesTenantAndFactoryFromServerContext() { const System.Reflection.BindingFlags flags = System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic; Assert.NotNull(typeof(S8ManualReportService).GetMethod( "ResolveTrustedScopeAsync", flags)); } [Fact] public void BackgroundJobs_DoNotKeepLegacyDefaultTenantConstants() { const System.Reflection.BindingFlags flags = System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Public; Assert.Null(typeof(S8WatchSchedulerJob).GetField("DefaultTenantId", flags)); Assert.Null(typeof(S8ActiveFlowStuckScanJob).GetField("DefaultTenantId", flags)); } }