public void GetTotalPoints_DifferentExercises()
        {
            var actual = ResultProcessor.GetTotalPoints(new[] { new AhkTaskResult()
                                                                {
                                                                    TaskName = "a", ExerciseName = "ex1", Points = 1
                                                                }, new AhkTaskResult()
                                                                {
                                                                    TaskName = "b", ExerciseName = "ex2", Points = 2.34
                                                                } });

            Assert.AreEqual(2, actual.Count);
            Assert.AreEqual("ex1", actual[0].Name);
            Assert.AreEqual(1, actual[0].Point);
            Assert.AreEqual("ex2", actual[1].Name);
            Assert.AreEqual(2.34, actual[1].Point);
        }
        internal Task <T> QueueDirectAsync <T>(Message message, ResultProcessor <T> processor, object asyncState = null, PhysicalBridge bridge = null)
        {
            var tcs    = TaskSource.CreateDenyExecSync <T>(asyncState);
            var source = ResultBox <T> .Get(tcs);

            message.SetSource(processor, source);
            if (bridge == null)
            {
                bridge = GetBridge(message.Command);
            }
            if (!bridge.TryEnqueue(message, isSlave))
            {
                ConnectionMultiplexer.ThrowFailed(tcs, ExceptionFactory.NoConnectionAvailable(multiplexer.IncludeDetailInExceptions, message.Command, message, this, multiplexer.GetServerSnapshot()));
            }
            return(tcs.Task);
        }
 internal override T ExecuteSync <T>(Message message, ResultProcessor <T> processor, ServerEndPoint server = null)
 {   // inject our expected server automatically
     if (server == null)
     {
         server = this.server;
     }
     FixFlags(message, server);
     if (!server.IsConnected)
     {
         if (message == null || message.IsFireAndForget)
         {
             return(default(T));
         }
         throw ExceptionFactory.NoConnectionAvailable(multiplexer.IncludeDetailInExceptions, message.Command, message, server, multiplexer.GetServerSnapshot());
     }
     return(base.ExecuteSync <T>(message, processor, server));
 }
示例#4
0
        public async Task <IEnumerable <NugetListingQuery> > Query(FilePath projectPath, bool outdated, bool includePrerelease, CancellationToken cancel)
        {
            var result = await ProcessRunner.RunAndCapture(
                NetCommandStartConstructor.Construct("list",
                                                     projectPath,
                                                     "package",
                                                     outdated ? "--outdated" : null,
                                                     includePrerelease ? "--include-prerelease" : null),
                cancel : cancel).ConfigureAwait(false);

            if (result.Errors.Count > 0)
            {
                throw new InvalidOperationException($"Error while retrieving nuget listings: \n{string.Join("\n", result.Errors)}");
            }

            return(ResultProcessor.Process(result.Out));
        }
示例#5
0
        public async Task <Result> QueryAsync(DistributorInput input)
        {
            var plan = _planner.Plan(input.Query);

            var sources = await _sourceResolver.ResolveAsync(input.Source).ConfigureAwait(false);

            var workerResultSets = _workerExecutor.ExecuteAsync(plan.WorkerPlan, sources);

            // TODO ordering+limit could be more efficient using the result sets directly (it might also be required for performance)
            var workerFetchedResultSets = workerResultSets.Select(x => _resultsFetcher.FetchAsync(x));
            var workerResults           = workerFetchedResultSets.SelectMany(x => x);

            var orderedResults = ResultProcessor.Order(plan.Order, workerResults);
            var limitedResults = ResultProcessor.Limit(plan.Limit, orderedResults);
            var results        = ProjectResults(limitedResults);

            return(await _resultsStorer.StoreAsync(results).ConfigureAwait(false));
        }
        protected override IEnumerable <IRunResult> RunConfigsCore(ParameterSet[] sweeps, IChannel ch, int min)
        {
            Parallel.For(0, sweeps.Length, _parallelOptions, j =>
            {
                var outFile   = GetFilePath(min + j, "out");
                var errorFile = GetFilePath(min + j, "err");
                var arguments = GetCommandLine(sweeps[j]);
                RunProcess(Exe, new string[] { arguments }, Environment.CurrentDirectory,
                           new StreamWriter(outFile),
                           new StreamWriter(errorFile));

                if (File.Exists(errorFile) && new FileInfo(errorFile).Length == 0)
                {
                    File.Delete(errorFile);
                }
            });
            return(sweeps.Select((sweep, j) =>
                                 ResultProcessor.GetRunResult(sweep, string.Format(@"{0}\{1}.out.txt", OutputFolder, min + j))));
        }
        private Message CreateMessage(CommandFlags flags, out ResultProcessor <bool> processor)
        {
            var work = pending;

            pending = null; // any new operations go into a different queue
            var cond = conditions;

            conditions = null; // any new conditions go into a different queue

            if ((work == null || work.Count == 0) && (cond == null || cond.Count == 0))
            {
                if ((flags & CommandFlags.FireAndForget) != 0)
                {
                    processor = null;
                    return(null); // they won't notice if we don't do anything...
                }
                processor = ResultProcessor.DemandPONG;
                return(Message.Create(-1, flags, RedisCommand.PING));
            }
            processor = TransactionProcessor.Default;
            return(new TransactionMessage(Database, flags, cond, work));
        }
示例#8
0
        protected void RunResultProcessorTest(string[] dataFiles, string outPath, string[] extraArgs)
        {
            Contracts.Assert(IsActive);

            File.Delete(outPath);

            List <string> args = new List <string>();

            for (int i = 0; i < dataFiles.Length; i++)
            {
                args.Add("\"" + dataFiles[i] + "\"");
            }
            args.Add("/o");
            args.Add(outPath);
            args.Add("/calledFromUnitTestSuite+");

            if (extraArgs != null)
            {
                args.AddRange(extraArgs);
            }
            ResultProcessor.Main(Env, args.ToArray());
        }
        private static ExpressionProcessor PrepareChain()
        {
            var div    = new DivisionProcessor();
            var mul    = new MultiplicationProcessor();
            var sub    = new SubtractionProcessor();
            var sum    = new SumProcessor();
            var res    = new ResultProcessor();
            var hash   = new HashProcessor();
            var dollar = new DollarProcessor();
            var excl   = new ExclamationProcessor();
            var mod    = new ModuloProcessor();

            mod.SetNextProcessor(div);
            div.SetNextProcessor(mul);
            mul.SetNextProcessor(sub);
            sub.SetNextProcessor(sum);
            sum.SetNextProcessor(hash);
            hash.SetNextProcessor(excl);
            excl.SetNextProcessor(dollar);
            dollar.SetNextProcessor(res);

            return(mod);
        }
示例#10
0
 internal override Task <T> ExecuteAsync <T>(Message message, ResultProcessor <T> processor, ServerEndPoint server = null)
 {   // inject our expected server automatically
     if (server == null)
     {
         server = this.server;
     }
     FixFlags(message, server);
     if (!server.IsConnected)
     {
         if (message == null)
         {
             return(CompletedTask <T> .Default(asyncState));
         }
         if (message.IsFireAndForget)
         {
             return(CompletedTask <T> .Default(null));                       // F+F explicitly does not get async-state
         }
         // no need to deny exec-sync here; will be complete before they see if
         var tcs = TaskSource.Create <T>(asyncState);
         ConnectionMultiplexer.ThrowFailed(tcs, ExceptionFactory.NoConnectionAvailable(multiplexer.IncludeDetailInExceptions, message.Command, message, server, multiplexer.GetServerSnapshot()));
         return(tcs.Task);
     }
     return(base.ExecuteAsync <T>(message, processor, server));
 }
示例#11
0
        ////Default request without search Term
        //public ActionResult ApiSearch()
        //{

        //    ViewBag.Message = ("SWAPI results");
        //    return View();
        //}

        //request with search Term
        public async Task <ActionResult> ApiSearch(string searchTerm)
        {
            if (searchTerm != null && searchTerm.Length < 10)
            {
                List <PersonModel> people = new List <PersonModel>();
                ResultModel        res    = await ResultProcessor.GetStarWarsRootinfo(searchTerm);

                for (int i = 0; i < res.Count; i++)
                {
                    people.Add(res.results[i]);

                    //Get and set species Name.
                    string[]     speciesUrl = res.results[i].Species;
                    SpeciesModel speciesRes = await SpeciesSearch(speciesUrl[0]);

                    people[i].SpeciesName = speciesRes.SpeciesName;


                    //Get and set Movie titles.
                    int      movieCount = res.results[i].Movies.Length;
                    string[] movieUrls  = res.results[i].Movies;
                    for (int x = 0; x < movieCount; x++)
                    {
                        string     url      = movieUrls[x];
                        MovieModel movieRes = await MovieSearch(url);

                        people[i].FilmsStarredIn.Add(movieRes);
                    }
                }
                return(View(people));
            }
            else
            {
                return(View("index"));
            }
        }
示例#12
0
        /// <summary>
        /// Runs the sequence coverage calculation.
        /// </summary>
        private async Task RunImpl()
        {
            var processor = new ResultProcessor(this.IonTypeFactoryViewModel.IonTypeFactory);

            try
            {
                var results = await processor.ProcessAsync(
                    this.RawFileSelector.FilePath,
                    this.MzIdFileSelector.FilePath,
                    this.cancellationToken.Token,
                    this.progressReporter);

                if (results.Count > 0)
                {
                    await ProcessedResult.WriteToFile(results, this.OutputFileSelector.FilePath);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }

            this.progressReporter.Report(new ProgressData());
        }
示例#13
0
        public static IQueryResultProcessor SelectQueryResultProcessor(ResultProcessor type, SearchSPIndexCmdlet cmdlet, SearchQueryRequest searchQueryRequest)
        {
            IQueryResultProcessor qrp = null;

            switch (type)
            {
            case ResultProcessor.Raw:
                qrp = new RawResultProcessor(cmdlet);
                break;

            case ResultProcessor.Primary:
                qrp = new PrimaryResultsResultProcessor(cmdlet);
                break;

            case ResultProcessor.All:
                qrp = new AllResultsResultProcessor(cmdlet);
                break;

            case ResultProcessor.Refiners:
                qrp = new RefinerResultProcessor(cmdlet);
                break;

            case ResultProcessor.Basic:
                qrp = new BasicResultProcessor(cmdlet);
                break;

            case ResultProcessor.BasicAll:
                qrp = new BasicAllResultProcessor(cmdlet);
                break;

            case ResultProcessor.RankXML:
                qrp = new RankXMLResultProcessor(cmdlet);
                break;

            case ResultProcessor.RankDetail:
                qrp = new RankDetailResultProcessor(cmdlet);
                break;

            case ResultProcessor.ExplainRank:
                qrp = new ExplainRankResultProcessor(cmdlet);
                break;

            case ResultProcessor.RankContribution:
                qrp = new RankContributionresultProcessor(cmdlet);
                break;

            case ResultProcessor.AllProperties:
                qrp = new AllPropertiesResultProcessor(cmdlet, searchQueryRequest);
                break;

            case ResultProcessor.AllPropertiesInline:
                qrp = new AllPropertiesInlineResultProcessor(cmdlet, searchQueryRequest);
                break;

            case ResultProcessor.ManagedProperties:
                qrp = new ManagedPropertiesResultProcessor(cmdlet, searchQueryRequest);
                break;

            case ResultProcessor.CrawledProperties:
                qrp = new CrawledPropertiesResultProcessor(cmdlet, searchQueryRequest);
                break;

            case ResultProcessor.FormatResults:
                qrp = new FormatResultsResultProcessor(cmdlet);
                break;

            default:
                throw new NotImplementedException("No result processor match " + type);
            }

            return(qrp);
        }
示例#14
0
 internal void SetSource(ResultProcessor resultProcessor, ResultBox resultBox)
 { // note order here reversed to prevent overload resolution errors
     this.resultBox       = resultBox;
     this.resultProcessor = resultProcessor;
 }
示例#15
0
 internal void SetSource <T>(ResultBox <T> resultBox, ResultProcessor <T> resultProcessor)
 {
     this.resultBox       = resultBox;
     this.resultProcessor = resultProcessor;
 }
 internal override T ExecuteSync <T>(Message message, ResultProcessor <T> processor, ServerEndPoint server = null)
 {
     throw new NotSupportedException("ExecuteSync cannot be used inside a transaction");
 }
        public void GetTotalPoints_EmptyArray()
        {
            var actual = ResultProcessor.GetTotalPoints(new AhkTaskResult[0]);

            Assert.AreEqual(0, actual.Count);
        }
 internal void WriteDirectOrQueueFireAndForget <T>(PhysicalConnection connection, Message message, ResultProcessor <T> processor)
 {
     if (message != null)
     {
         message.SetSource(processor, null);
         if (connection == null)
         {
             multiplexer.Trace("Enqueue: " + message);
             GetBridge(message.Command).TryEnqueue(message, isSlave);
         }
         else
         {
             multiplexer.Trace("Writing direct: " + message);
             connection.Bridge.WriteMessageDirect(connection, message);
         }
     }
 }
示例#19
0
        public static async Task Main(string[] args)
        {
            //using (var context = new BloggingContext())
            //{
            //    context.Database.EnsureDeleted();
            //    context.Database.EnsureCreated();
            //    var blog = new Blog
            //    {
            //        Url = "http://vswebessentials.com/blog"
            //    };
            //    context.Blogs.Add(blog);
            //    context.SaveChanges();
            //}

            var containerBuilder = new ContainerBuilder();

            containerBuilder.RegisterType <BloggingContext>().InstancePerLifetimeScope();

            containerBuilder.RegisterType <TestCommandHandler>().As <IAsyncCommandHandler <TestCommand, List <TestData> > >();
            containerBuilder.RegisterType <GetBlogCommandHandler>().As <IAsyncCommandHandler <GetBlogCommand, BlogData> >();
            containerBuilder.RegisterType <CreatePostCommandHandler>().As <IAsyncCommandHandler <CreatePostCommand, PostData> >();

            containerBuilder.RegisterType <FakeCommandHandler>().As <IAsyncCommandHandler <FakeCommand, FakeData> >();

            containerBuilder.RegisterType <MultipleCommandHandler>().As <IAsyncCommandHandler <MultipleCommand, MultipleData> >();

            containerBuilder.RegisterType <IntCommandHandler>().As <IAsyncCommandHandler <IntCommand, int> >();
            containerBuilder.RegisterType <LongCommandHandler>().As <IAsyncCommandHandler <LongCommand, long> >();
            containerBuilder.RegisterType <NoneCommandHandler>().As <IAsyncCommandHandler <NoneCommand, Unit> >();
            containerBuilder.RegisterType <ExceptionCommandHandler>().As <IAsyncCommandHandler <ExceptionCommand, Unit> >();

            var commandsBuilder = new AutofacCommandsBuilder(containerBuilder);

            commandsBuilder.Use <TestPipeline>();
            commandsBuilder.Use <SecondTestPipeline>();

            commandsBuilder.Use <ExecutingNotification>();
            commandsBuilder.Use <ExecutedNotification>();
            commandsBuilder.Use <ExceptionNotification>();

            containerBuilder.RegisterInstance(commandsBuilder).SingleInstance();
            containerBuilder.RegisterType <AutofacLifetimeScopeService>().As <ILifetimeScopeService>();

            containerBuilder.RegisterType <CommandProcessor>().As <ICommandProcessor>();

            var container = containerBuilder.Build();

            var commandProcessor = container.Resolve <ICommandProcessor>();
            //var commandProcessor = new CommandProcessor(commandsBuilder, new AutofacLifetimeScopeService(container.BeginLifetimeScope()));

            var connectionMultiplexer = await ConnectionMultiplexer.ConnectAsync("localhost,allowAdmin=true");

            var containerSerializer = new NewtonsoftJsonContainerSerializer();

            var commandProcessorClient = new CommandProcessorClient(new RedisCommandTransportClient("test~commands", "test~results", connectionMultiplexer, containerSerializer));
            var commandTransportServer = new RedisCommandTransportServer("test~commands", "group", "consumer_1", connectionMultiplexer, containerSerializer);
            var commandProcessorServer = new CommandProcessorServer(commandProcessor, commandTransportServer);

            await commandTransportServer.StartAsync();

            var intResult = await commandProcessorClient.ProcessAsync(new IntCommand(2));

            var longResult = await commandProcessorClient.ProcessAsync(new LongCommand(2));

            var noneResult = await commandProcessorClient.ProcessAsync(new NoneCommand());

            await Task.Delay(-1);

            try
            {
                var exceptionResult = await commandProcessorClient.ProcessAsync(new ExceptionCommand());
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }

            await Task.Delay(-1);

            var resultRegister = new ResultRegister <HttpResult>();

            resultRegister.When <NotFoundException>().Return(r => new HttpResult(444444444));
            var resultProcessor = new ResultProcessor <HttpResult>(resultRegister.Emit(), commandsBuilder,
                                                                   new AutofacLifetimeScopeService(container.BeginLifetimeScope()));


            string jsonString = JsonConvert.SerializeObject(new IntCommand {
                Id = 2
            }, Formatting.Indented, new JsonSerializerSettings
            {
                TypeNameHandling = TypeNameHandling.All
            });

            var commandObject = JsonConvert.DeserializeObject(jsonString, new JsonSerializerSettings
            {
                TypeNameHandling = TypeNameHandling.All
            });

            try
            {
                var throws = await resultProcessor.For(new FakeCommand(-1)).ExecuteAsync();

                var test = await commandProcessor.ProcessAsync(new FakeCommand(-1));
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
            Console.WriteLine();
            Console.WriteLine();
            var test1 = commandProcessor.ProcessAsync(new FakeCommand(10)).Result;

            Console.WriteLine();



            // TODO: need to be able to add in global stuff
            // TODO: ExecuteSuccessAsync could be from another Processor? like a non-generic one


            try
            {
                var throws = commandProcessor.ProcessAsync(new TestCommand()).Result;
            }
            catch (Exception)
            {
                // ignore
            }

            // using default handlers
            var defultHandlers = resultProcessor.For(new TestCommand())
                                 //.When(o => o.NotFound()).Return(r => new HttpResult(404))
                                 .When(o => o.Conflict()).Return(r => new HttpResult(409))
                                 .When(o => o.Success()).Return(r => new HttpResult(200))
                                 .Catch <Exception>().Return(e => new HttpResult(500))
                                 .ExecuteAsync().Result;

            // checking lifetime
            for (int i = 0; i < 2; i++)
            {
                var lifetime = resultProcessor.For(new GetBlogCommand(1))
                               .When(o => o.NotFound()).Return(r => new HttpResult(404))
                               .When(o => o.Success()).Return(r => new HttpResult(200))
                               .ExecuteAsync().Result;
            }

            // internal use of command
            var toReturn = resultProcessor.For(new CreatePostCommand(1, "2", "My Blog", "Good day!"))
                           .When(o => o.NotFound()).Return(r => new HttpResult(404))
                           .When(o => o.Conflict()).Return(r => new HttpResult(409))
                           .When(o => o.Success()).Return(r => new HttpResult(200))
                           .ExecuteAsync().Result;


            // multiple commands with same handler
            var multipleOne = resultProcessor.For(new MultipleOneCommand())
                              .When(o => o.Success()).Return(r => new HttpResult(r.Result))
                              .ExecuteAsync().Result;

            var multipleTwo = resultProcessor.For(new MultipleTwoCommand())
                              .When(o => o.Success()).Return(r => new HttpResult(r.Result))
                              .ExecuteAsync().Result;

            var intReturn = resultProcessor.For(new IntCommand())
                            .When(o => o.Success()).Return(r => new HttpResult(r))
                            .ExecuteAsync().Result;

            // checking it throws the exceptions
            try
            {
                var throws = commandProcessor.ProcessAsync(new FakeCommand(-1)).Result;
            }
            catch (Exception)
            {
                // ignore
            }
        }
示例#20
0
        public static async Task Main(string[] args)
        {
            //using (var context = new BloggingContext())
            //{
            //    context.Database.EnsureDeleted();
            //    context.Database.EnsureCreated();
            //    var blog = new Blog
            //    {
            //        Url = "http://vswebessentials.com/blog"
            //    };
            //    context.Blogs.Add(blog);
            //    context.SaveChanges();
            //}

            var containerBuilder = new ContainerBuilder();

            containerBuilder.RegisterType <BloggingContext>().InstancePerLifetimeScope();

            containerBuilder.RegisterType <TestCommandHandler>().As <IAsyncCommandHandler <TestCommand, List <TestData> > >();
            containerBuilder.RegisterType <GetBlogCommandHandler>().As <IAsyncCommandHandler <GetBlogCommand, BlogData> >();
            containerBuilder.RegisterType <CreatePostCommandHandler>().As <IAsyncCommandHandler <CreatePostCommand, PostData> >();

            containerBuilder.RegisterType <FakeCommandHandler>().As <IAsyncCommandHandler <FakeCommand, FakeData> >();

            containerBuilder.RegisterType <MultipleCommandHandler>().As <IAsyncCommandHandler <MultipleCommand, MultipleData> >();

            containerBuilder.RegisterType <IntCommandHandler>().As <IAsyncCommandHandler <IntCommand, int> >();
            containerBuilder.RegisterType <NoneCommandHandler>().As <IAsyncCommandHandler <NoneCommand, Unit> >();

            var commandsBuilder = new AutofacCommandsBuilder(containerBuilder);

            commandsBuilder.Use <TestPipeline>();
            commandsBuilder.Use <SecondTestPipeline>();

            commandsBuilder.Use <ExecutingNotification>();
            commandsBuilder.Use <ExecutedNotification>();
            commandsBuilder.Use <ExceptionNotification>();

            containerBuilder.RegisterInstance(commandsBuilder).SingleInstance();
            containerBuilder.RegisterType <AutofacLifetimeScopeService>().As <ILifetimeScopeService>();

            containerBuilder.RegisterType <CommandProcessor>().As <ICommandProcessor>();

            var container = containerBuilder.Build();

            var commandProcessor = container.Resolve <ICommandProcessor>();
            //var commandProcessor = new CommandProcessor(commandsBuilder, new AutofacLifetimeScopeService(container.BeginLifetimeScope()));

            var resultRegister = new ResultRegister <HttpResult>();

            resultRegister.When <NotFoundException>().Return(r => new HttpResult(444444444));
            var resultProcessor = new ResultProcessor <HttpResult>(resultRegister.Emit(), commandsBuilder,
                                                                   new AutofacLifetimeScopeService(container.BeginLifetimeScope()));

            try
            {
                var throws = await resultProcessor.For(new FakeCommand(-1)).ExecuteAsync();

                var test = await commandProcessor.ProcessAsync(new FakeCommand(-1));
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
            Console.WriteLine();
            Console.WriteLine();
            var test1 = commandProcessor.ProcessAsync(new FakeCommand(10)).Result;

            Console.WriteLine();



            // TODO: need to be able to add in global stuff
            // TODO: ExecuteSuccessAsync could be from another Processor? like a non-generic one


            try
            {
                var throws = commandProcessor.ProcessAsync(new TestCommand()).Result;
            }
            catch (Exception)
            {
                // ignore
            }

            // using default handlers
            var defultHandlers = resultProcessor.For(new TestCommand())
                                 //.When(o => o.NotFound()).Return(r => new HttpResult(404))
                                 .When(o => o.Conflict()).Return(r => new HttpResult(409))
                                 .When(o => o.Success()).Return(r => new HttpResult(200))
                                 .Catch <Exception>().Return(e => new HttpResult(500))
                                 .ExecuteAsync().Result;

            // checking lifetime
            for (int i = 0; i < 2; i++)
            {
                var lifetime = resultProcessor.For(new GetBlogCommand(1))
                               .When(o => o.NotFound()).Return(r => new HttpResult(404))
                               .When(o => o.Success()).Return(r => new HttpResult(200))
                               .ExecuteAsync().Result;
            }

            // internal use of command
            var toReturn = resultProcessor.For(new CreatePostCommand(1, "2", "My Blog", "Good day!"))
                           .When(o => o.NotFound()).Return(r => new HttpResult(404))
                           .When(o => o.Conflict()).Return(r => new HttpResult(409))
                           .When(o => o.Success()).Return(r => new HttpResult(200))
                           .ExecuteAsync().Result;


            // multiple commands with same handler
            var multipleOne = resultProcessor.For(new MultipleOneCommand())
                              .When(o => o.Success()).Return(r => new HttpResult(r.Result))
                              .ExecuteAsync().Result;

            var multipleTwo = resultProcessor.For(new MultipleTwoCommand())
                              .When(o => o.Success()).Return(r => new HttpResult(r.Result))
                              .ExecuteAsync().Result;

            var intReturn = resultProcessor.For(new IntCommand())
                            .When(o => o.Success()).Return(r => new HttpResult(r))
                            .ExecuteAsync().Result;

            // checking it throws the exceptions
            try
            {
                var throws = commandProcessor.ProcessAsync(new FakeCommand(-1)).Result;
            }
            catch (Exception)
            {
                // ignore
            }
        }