public async Task GetDeletionAuditRecords_FiltersOnAll_EntryExists()
        {
            // Arrange
            var auditingStorage = new MemoryStorage();

            var targetPackageIdentity = new PackageIdentity("targetPackage", NuGetVersion.Parse("3.2.1"));
            var minTimestamp          = DefaultAuditRecordTimeStamp.Subtract(new TimeSpan(2, 0, 0));
            var maxTimestamp          = DefaultAuditRecordTimeStamp.Subtract(new TimeSpan(1, 0, 0));

            AddAuditRecordToMemoryStorage(auditingStorage, targetPackageIdentity, timestamp: minTimestamp.Add(new TimeSpan((maxTimestamp.Ticks - minTimestamp.Ticks) / 2)));
            AddDummyAuditRecords(auditingStorage, (count) => targetPackageIdentity.Id, (count) => targetPackageIdentity.Version.ToNormalizedString());

            // Act
            var auditEntries = await DeletionAuditEntry.GetAsync(CreateStorageFactory(auditingStorage, targetPackageIdentity), CancellationToken.None, targetPackageIdentity, minTimestamp, maxTimestamp, logger : _logger);

            // Assert
            Assert.Equal(1, auditEntries.Count());

            var auditEntry = auditEntries.ElementAt(0);

            Assert.Equal(targetPackageIdentity.Id, auditEntry.PackageId);
            Assert.Equal(targetPackageIdentity.Version.ToString(), auditEntry.PackageVersion);
            Assert.True(auditEntry.TimestampUtc.HasValue);
            Assert.True(auditEntry.TimestampUtc.Value.Ticks >= minTimestamp.Ticks);
            Assert.True(auditEntry.TimestampUtc.Value.Ticks <= maxTimestamp.Ticks);
        }
        public async Task GetDeletionAuditRecords_FiltersOnMaxTimestamp_EntryMissing()
        {
            // Arrange
            var auditingStorage = new MemoryStorage();

            var maxTimestamp = DefaultAuditRecordTimeStamp.Subtract(new TimeSpan(1, 0, 0));

            AddDummyAuditRecords(auditingStorage);

            // Act
            var auditEntries = await DeletionAuditEntry.GetAsync(auditingStorage, CancellationToken.None, maxTime : maxTimestamp, logger : _logger);

            // Assert
            Assert.Empty(auditEntries);
        }
        public async Task GetDeletionAuditRecords_FiltersOnAll_EntryMissing()
        {
            // Arrange
            var auditingStorage = new MemoryStorage();

            var targetPackageIdentity = new PackageIdentity("targetPackage", NuGetVersion.Parse("3.2.1"));
            var minTimestamp          = DefaultAuditRecordTimeStamp.Subtract(new TimeSpan(2, 0, 0));
            var maxTimestamp          = DefaultAuditRecordTimeStamp.Subtract(new TimeSpan(1, 0, 0));

            AddDummyAuditRecords(auditingStorage, (count) => targetPackageIdentity.Id, (count) => targetPackageIdentity.Version.ToNormalizedString());

            // Act
            var auditEntries = await DeletionAuditEntry.GetAsync(CreateStorageFactory(auditingStorage, targetPackageIdentity), CancellationToken.None, targetPackageIdentity, minTimestamp, maxTimestamp, logger : _logger);

            // Assert
            Assert.Empty(auditEntries);
        }
        public async Task GetDeletionAuditRecords_FiltersOnMaxTimestamp_EntryExists()
        {
            // Arrange
            var auditingStorage = new MemoryStorage();

            var maxTimestamp = DefaultAuditRecordTimeStamp.Subtract(new TimeSpan(1, 0, 0));

            AddAuditRecordToMemoryStorage(auditingStorage, package: null, timestamp: maxTimestamp);
            AddDummyAuditRecords(auditingStorage);

            // Act
            var auditEntries = await DeletionAuditEntry.GetAsync(auditingStorage, CancellationToken.None, maxTime : maxTimestamp, logger : _logger);

            // Assert
            Assert.Equal(1, auditEntries.Count());

            var auditEntry = auditEntries.ElementAt(0);

            Assert.True(auditEntry.TimestampUtc.HasValue);
            Assert.True(auditEntry.TimestampUtc.Value.Ticks <= maxTimestamp.Ticks);
        }