Exemplo n.º 1
0
        public async Task ShouldBatchAllItemsTogether()
        {
            var processor = new IntProcessor();

            await TestAsync(options => options
                            .MaximumQueueCountBeforeAutoFlush(5)
                            .AddProcessorSingleton <int, IntProcessor>(processor),
                            async http =>
            {
                var ids = Enumerable.Range(0, 5);

                await Task.WhenAll(ids.Select(id => http.GetAsync($"/{id}")));
                WaitOrThrow(processor.Event, 500);

                var batch = Assert.Single(processor.Batches);

                Assert.Equal(ids, batch.Items.OrderBy(x => x));
            });
        }
Exemplo n.º 2
0
        public void GivenIsAnIntProcessor(string key)
        {
            IValueProcessor processor = new IntProcessor(_scenario);

            _scenario.Set(processor, key);
        }