public async Task WhenMethodDoesNotMatch_ThenEventsAreNotProcessed(
            [Credential(Role = PredefinedRole.StorageObjectViewer)] ResourceTask <ICredential> credential)
        {
            var service = new AuditLogStorageSinkAdapter(
                new StorageAdapter(await credential),
                new AuditLogAdapter(await credential));

            var eventsProcessed = new List <EventBase>();
            var processor       = new Mock <IEventProcessor>();

            processor.SetupGet(p => p.ExpectedOrder).Returns(EventOrder.OldestFirst);
            processor.SetupGet(p => p.SupportedMethods).Returns(new[] { "SomeOtherMethod" });
            processor.SetupGet(p => p.SupportedSeverities).Returns(new[] { "INFO" });
            processor
            .Setup(p => p.Process(It.IsAny <EventBase>()))
            .Callback((EventBase e) => eventsProcessed.Add(e));

            var jan1 = new DateTime(2020, 1, 1, 0, 0, 0, DateTimeKind.Utc);

            await service.ProcessInstanceEventsAsync(
                GcsTestData.Bucket,
                jan1,
                jan1.AddMonths(1),
                processor.Object,
                CancellationToken.None);

            Assert.AreEqual(0, eventsProcessed.Count);
        }
        public async Task WhenExpectedOrderIsOldestFirst_ThenEventsAreProcessedInAscendingOrder(
            [Credential(Role = PredefinedRole.StorageObjectViewer)] ResourceTask <ICredential> credential)
        {
            var service = new AuditLogStorageSinkAdapter(
                new StorageAdapter(await credential),
                new AuditLogAdapter(await credential));

            var eventsProcessed = new List <EventBase>();
            var processor       = new Mock <IEventProcessor>();

            processor.SetupGet(p => p.ExpectedOrder).Returns(EventOrder.OldestFirst);
            processor.SetupGet(p => p.SupportedMethods).Returns(new[] { "NotifyInstanceLocation" });
            processor.SetupGet(p => p.SupportedSeverities).Returns(new[] { "INFO", "ERROR" });
            processor
            .Setup(p => p.Process(It.IsAny <EventBase>()))
            .Callback((EventBase e) => eventsProcessed.Add(e));

            var jan1 = new DateTime(2020, 1, 1, 0, 0, 0, DateTimeKind.Utc);

            await service.ProcessInstanceEventsAsync(
                GcsTestData.Bucket,
                jan1,
                jan1.AddMonths(1),
                processor.Object,
                CancellationToken.None);

            Assert.AreEqual(5, eventsProcessed.Count);

            Assert.AreEqual(EventTimestamp_Jan1_00_01, eventsProcessed[0].Timestamp);
            Assert.AreEqual(EventTimestamp_Jan1_00_02, eventsProcessed[1].Timestamp);
            Assert.AreEqual(EventTimestamp_Jan1_00_03, eventsProcessed[2].Timestamp);
            Assert.AreEqual(EventTimestamp_Jan1_01_01, eventsProcessed[3].Timestamp);
            Assert.AreEqual(EventTimestamp_Jan2_00_01, eventsProcessed[4].Timestamp);
        }