public async void When_RequestPipelineParallel_ExecPipeLine_Parallel_With_MoreThanOne_Handler() { Mock <IHandlersServiceProvider> providerMock = new Mock <IHandlersServiceProvider>(); TestRequest1 testRequest1 = new TestRequest1(); testRequest1.text = "1"; TestRequest2 testRequest2 = new TestRequest2(); testRequest2.text = "1"; providerMock.Setup(o => o.GetHandlers(testRequest1)).Returns(new List <IBaseHandler> { new HandlersSample1() }); providerMock.Setup(o => o.GetHandlers(testRequest2)).Returns(new List <IBaseHandler> { new HandlersSample2() }); RequestPipelineParallel provider = new RequestPipelineParallel(providerMock.Object); var res = await provider.ExecPipeline(testRequest1); var res2 = await provider.ExecPipeline(testRequest2); res.GetResponse <TestResponse1>().ShouldNotBeNull(); res.ResponseHasErros().ShouldBeFalse(); ((TestResponse1)res.FirstOrDefault()).text.ShouldBe(testRequest1.text); res.Count.ShouldBe(1); res2.GetResponse <TestResponse2>().ShouldNotBeNull(); res2.ResponseHasErros().ShouldBeFalse(); ((TestResponse2)res2.FirstOrDefault()).text.ShouldBe(testRequest2.text); res2.Count.ShouldBe(1); }
public async void When_RequestPipelineParallel_ExecPipeLine_Parallel_With_MoreThanOne_Execpetion() { Mock <IHandlersServiceProvider> providerMock = new Mock <IHandlersServiceProvider>(); TestRequest1 testRequest1 = new TestRequest1(); testRequest1.text = "1"; providerMock.Setup(o => o.GetHandlers(testRequest1)).Returns(new List <IBaseHandler> { new HandlersSample1(), new HandlersSampleWithErrorExecption() }); RequestPipelineParallel provider = new RequestPipelineParallel(providerMock.Object); var res = await provider.ExecPipeline(testRequest1); res.ResponseHasErros().ShouldBeTrue(); res.GetErrorResponse <DefaultResponseError>().ShouldNotBeNull(); }
public async void When_RequestPipelineParallel_ExecPipeLine_Parallel_With_MoreThanOne_PreHandler_Error() { Mock <IHandlersServiceProvider> providerMock = new Mock <IHandlersServiceProvider>(); TestRequest1 testRequest1 = new TestRequest1(); testRequest1.text = "1"; providerMock.Setup(o => o.GetHandlers(testRequest1)).Returns(new List <IBaseHandler> { new HandlersSample1(), new HandlersSampleWithError() }); RequestPipelineParallel provider = new RequestPipelineParallel(providerMock.Object); var res = await provider.ExecPipeline(testRequest1); res.FirstOrDefault().ShouldNotBeNull(); res.Count.ShouldBe(1); res.Any(o => o.AnyError).ShouldBeTrue(); }