public async Task <IActionResult> Index()
        {
            _pipeline = await _pipelineAlloc.RetrievePipeline();

            await _pipeline.FillPipeline(new Default());

            await _pipeline.FillPipeline(new Default());

            _pipeline.Complete();
            await _pipeline.WaitForResults();

            var results = await _pipeline.GetResults();

            ViewBag.Results = results;

            _pipeline = await _pipelineAlloc.RetrievePipeline();

            List <Default> inputs = new List <Default>();

            inputs.Add(new Default("Forget Pipeline", 300));
            inputs.Add(new Default("Forget Pipeline Two", 300));
            _pipeline.ProcessAndForget(inputs);

            return(View());
        }
예제 #2
0
        public async Task <ActionResult> Index()
        {
            User user = new User();

            user.Username = "******";
            user.Name     = "Dylan Steele";

            await _pipeline.Post(user);

            await _pipeline.Complete();

            await _pipeline.WaitForResultsAsync();

            var users = _pipeline.GetResults().Result;
            await _pipeline.Flush();

            //TestPipeline pipeline = new TestPipeline();
            //pipeline.Post(user);
            //pipeline.InputBlock.Complete();
            //await pipeline.CompletionTask;
            //var t = pipeline.Result;
            //List<User> test = new List<User>();
            //test.Add(user);
            ViewBag.Users = users;

            //TimingTest timingTest = new TimingTest();

            //GenerateOrder randomOrder = new GenerateOrder(OrderType.CarLoan);

            //_pipelineService.FillPipeline(randomOrder.order);
            //_pipelineService.FillPipeline(new GenerateOrder(OrderType.HomeLoan).order);
            //_pipelineService.FillPipeline(new GenerateOrder(OrderType.OtherLoan).order);
            //_pipelineService.FillPipeline(new GenerateOrder(OrderType.PersonalLoan).order);
            //_pipelineService.FillPipeline(new GenerateOrder(OrderType.CarLoan).order);

            //_pipelineService.WaitForResults();

            //var test = _pipelineService.GetResults().Result;
            ////Flush the results of the pipeline after receiving them
            //_pipelineService.FlushPipeline();
            //List<Order> receivedOrders = new List<Order>();
            //foreach (object inputOrder in test)
            //{
            //    var order = (Order)inputOrder;
            //    if (!string.IsNullOrEmpty(order.ClientFName))
            //    {
            //        receivedOrders.Add((Order)inputOrder);
            //    }
            //}
            //ViewBag.Orders = receivedOrders;

            return(View());
        }
        public void TestDefaultPipeline(string message, int number)
        {
            IPipelineAlloc <DefaultPipeline> pipelineAlloc = new PipelineAlloc <DefaultPipeline>();
            IPipeline <Default> pipeline = pipelineAlloc.RetrievePipeline().Result;

            pipeline.FillPipeline(new Default(message, number));
            pipeline.Complete();
            pipeline.WaitForResults().Wait();
            var result = pipeline.GetResults().Result;
            var item   = result.FirstOrDefault();

            Assert.True(result.Count == 1);
            Assert.Equal(item.message, message);
            Assert.Equal(item.randomNumber, number);
        }