Exemplo n.º 1
0
        public void BulkTask()
        {
            var sw = new Stopwatch();

            sw.Start();

            const int count = 20;
            var       tasks = new Task <SendEmailResponse> [count];

            for (int i = 0; i < count; i++)
            {
                var cmd = new SendEmailCommand
                {
                    Source = Helper.GetSenderEmailAddress(),
                };

                cmd.Message.Subject.Data   = "testing SES";
                cmd.Message.Body.Html.Data = "<b>this is bold text</b>";
                cmd.Message.Body.Text.Data = "this is not bold text";
                cmd.Destination.ToAddresses.Add(Helper.GetRecipientEmailAddress());

                var cp = new CommandProcessor(_builder);
                tasks[i] = cp.CreateTask(cmd, new SendEmailResponseParser());
            }

            Task.WaitAll(tasks);
            sw.Stop();
            Console.WriteLine(sw.Elapsed);
        }
Exemplo n.º 2
0
        public void BulkTask()
        {
            var sw = new Stopwatch();

            sw.Start();

            const int count = 10;
            var       tasks = new Task <GetSendQuoteResponse> [count];

            for (int i = 0; i < count; i++)
            {
                var cmd = new GetSendQuotaCommand();

                tasks[i] = _cp.CreateTask(cmd, new GetSendQuoteResponseParser());
            }

            Task.WaitAll(tasks);
            sw.Stop();
            Console.WriteLine(sw.Elapsed);
        }