using Explorer.Application; using Explorer.Domain; using Explorer.Windows; namespace Explorer.Application.Tests; public class RemovableAutoIndexPlannerTests { [Fact] public void Does_nothing_when_disabled() { var sources = new[] { Removable(1, indexed: false) }; Assert.Empty(RemovableAutoIndexPlanner.SourceIdsToScan(sources, autoIndexRemovable: false)); } [Fact] public void Queues_online_unindexed_removable_only() { var sources = new[] { Removable(1, indexed: false), Removable(2, indexed: true), Removable(3, indexed: false, status: SourceStatus.Offline), Cloud(4), Local(5) }; Assert.Equal(new[] { 1L }, RemovableAutoIndexPlanner.SourceIdsToScan(sources, autoIndexRemovable: true)); } private static Source Removable(long id, bool indexed, SourceStatus status = SourceStatus.Online) => new() { Id = id, StableKey = id.ToString(), Kind = SourceKind.Removable, DisplayName = "USB", LastRootPath = @"E:\", Status = status, LastIndexedUtc = indexed ? DateTimeOffset.UtcNow : null }; private static Source Cloud(long id) => new() { Id = id, StableKey = "cloud", Kind = SourceKind.Cloud, DisplayName = "Cloud", LastRootPath = @"C:\Users\me\OneDrive", Status = SourceStatus.Online }; private static Source Local(long id) => new() { Id = id, StableKey = "local", Kind = SourceKind.NtfsLocal, DisplayName = "Local", LastRootPath = @"C:\", Status = SourceStatus.Online }; } public class ElevatedScanServiceTests { [Fact] public void Never_requests_elevation() { IElevatedScanService service = new WindowsElevatedScanService(); Assert.False(service.CanRequestElevation); } }