public void RunPipeline() { try { Configuration config = GetConfiguration(); Assert.NotNull(config); PipelineBuilder builder = new PipelineBuilder(); builder.Load(config.RootConfigNode); BasicPipeline <User> pipeline = (BasicPipeline <User>)builder.GetPipeline <User>("UserDataPipeline"); Assert.NotNull(pipeline); LogUtils.Debug("UserDataPipeline>>", pipeline); User user = new User(); ProcessResponse <User> response = pipeline.Execute(user, null, null); Assert.Equal(EProcessResponse.FatalError, response.State); user.LastName = "TestUser"; response = pipeline.Execute(user, null, null); Assert.Equal(EProcessResponse.OK, response.State); Assert.False(String.IsNullOrWhiteSpace(user.EmailId)); Assert.False(user.IsAdult); user.FirstName = "First"; user.DateOfBirth = DateTime.Parse("07/21/1953"); response = pipeline.Execute(user, null, null); Assert.Equal(EProcessResponse.OK, response.State); Assert.True(user.IsAdult); } catch (Exception ex) { LogUtils.Error(ex); throw ex; } }
public void GetPipelineForUnregisteredMessageShouldReturnNull() { var busBuilder = new BusBuilder(); var piplineBuilder = new PipelineBuilder(busBuilder); var pipeline = piplineBuilder.GetPipeline(typeof(TestMessageA)); pipeline.Should().NotBeNull(); pipeline.HandlerTypes.Count.Should().Be(0); }
public void GetPipelineWithPolymorphicHandlerRegistrationShouldHaveHandlerWithLessSpecializedType() { var busBuilder = new BusBuilder() .RegisterHandler <TestMessageA, TestMessageAHandler>(); var piplineBuilder = new PipelineBuilder(busBuilder); var pipeline = piplineBuilder.GetPipeline(typeof(TestMessageB)); pipeline.Should().NotBeNull(); pipeline.HandlerTypes.Count.Should().Be(1); }
public void GetPipelineForRegisteredMessageShouldNotBeNull() { var busBuilder = new BusBuilder() .RegisterHandler <TestMessageA, TestMessageAHandler>(); var piplineBuilder = new PipelineBuilder(busBuilder); var pipeline = piplineBuilder.GetPipeline(typeof(TestMessageA)); pipeline.Should().NotBeNull(); pipeline.HandlerTypes.Count.Should().Be(1); }
public void GetPipelineWithTwoOfTheSameMessageShouldHaveMultipleHandlers() { var busBuilder = new BusBuilder() .RegisterHandler <TestMessageA, TestMessageAHandler>() .RegisterHandler <TestMessageA, OtherTestMessageAHandler>(); var piplineBuilder = new PipelineBuilder(busBuilder); var pipeline = piplineBuilder.GetPipeline(typeof(TestMessageA)); pipeline.Should().NotBeNull(); pipeline.HandlerTypes.Count.Should().Be(2); }
public void MultipleRegistrationsToHandlerShouldOnlyHaveOneHandlerInPipeline() { var busBuilder = new BusBuilder() .RegisterHandler <TestMessageA, TestMessageAHandler>() .RegisterHandler <TestMessageB, TestMessageAHandler>() .RegisterHandler <TestMessageC, TestMessageAHandler>(); var piplineBuilder = new PipelineBuilder(busBuilder); var pipeline = piplineBuilder.GetPipeline(typeof(TestMessageA)); pipeline.HandlerTypes.Count.Should().Be(1); pipeline.HandlerTypes.First().Should().Be(typeof(TestMessageAHandler)); }
public void LoadPipeline() { try { Configuration config = GetConfiguration(); Assert.NotNull(config); PipelineBuilder builder = new PipelineBuilder(); builder.Load(config.RootConfigNode); Pipeline <User> pipeline = builder.GetPipeline <User>("UserDataPipeline"); Assert.NotNull(pipeline); LogUtils.Debug("UserDataPipeline>>", pipeline); pipeline = builder.GetPipeline <User>("UserDataPipelineRef"); Assert.NotNull(pipeline); LogUtils.Debug("UserDataPipelineRef>>", pipeline); } catch (Exception ex) { LogUtils.Error(ex); throw ex; } }