public void SimulatesBusinessProcess()
        {
            // arrange
            var dispatcher = _container.GetService<IRequestDispatcher>();
            var sendMail1 = new SendMail
                            {
                                Messages = new[]
                                           {
                                               new MailMessage {From = "Delayed 1", Priority = 1},
                                               new MailMessage {From = "Express 1", Priority = 3},
                                               new MailMessage {From = "Standard 1", Priority = 2},
                                           }
                            };
            var sendMail2 = new SendMail
                            {
                                Messages = new[]
                                           {
                                               new MailMessage {From = "Delayed 2", Priority = 1},
                                               new MailMessage {From = "Express 2", Priority = 3},
                                               new MailMessage {From = "Standard 2", Priority = 2},
                                           }
                            };

            // act
            dispatcher.DispatchCommand(sendMail1);
            dispatcher.DispatchCommand(sendMail2);

            // assert
        }
        public async Task SimulatesAsynchronousBusinessProcess()
        {
            // arrange
            var dispatcher = _container.GetService<IRequestDispatcher>();
            var sendMail1 = new SendMail {Messages = Enumerable.Range(1, Randomizer.Next(30)).Select(x => new MailMessage {Priority = Randomizer.Next(100)}).ToArray()};
            var sendMail2 = new SendMail {Messages = Enumerable.Range(1, Randomizer.Next(30)).Select(x => new MailMessage {Priority = Randomizer.Next(100)}).ToArray()};
            var sendMail3 = new SendMail {Messages = Enumerable.Range(1, Randomizer.Next(30)).Select(x => new MailMessage {Priority = Randomizer.Next(100)}).ToArray()};

            // act
            await Task.WhenAll(dispatcher.DispatchCommandAsync(sendMail1),
                               dispatcher.DispatchCommandAsync(sendMail2),
                               dispatcher.DispatchCommandAsync(sendMail3));

            // assert
        }