コード例 #1
0
        private async Task EventHubListener_CreatesCheckpointStrategy(int batchCheckpointFrequency, int expected)
        {
            var iterations = 100;
            var strategy   = EventHubListener.CreateCheckpointStrategy(batchCheckpointFrequency);

            var         checkpoints = 0;
            Func <Task> checkpoint  = () =>
            {
                checkpoints++;
                return(Task.CompletedTask);
            };

            for (int i = 0; i < iterations; i++)
            {
                await strategy(checkpoint);
            }

            Assert.Equal(expected, checkpoints);
        }
コード例 #2
0
        private void EventHubListener_Throws_IfInvalidCheckpointStrategy(int batchCheckpointFrequency)
        {
            var exc = Assert.Throws <InvalidOperationException>(() => EventHubListener.CreateCheckpointStrategy(batchCheckpointFrequency));

            Assert.Equal("Batch checkpoint frequency must be larger than 0.", exc.Message);
        }