예제 #1
0
        public void ConstructorIfFinishRequestHandlersAreNullShouldThrowExceptionTest()
        {
            // Act & Assert
            var exception = Assert.Throws <ArgumentNullException>(() => new Pipeline <TestRequest, object>(
                                                                      Substitute.For <IRequestHandler <TestRequest, object> >(),
                                                                      PipelineTest.CreatePreRequestHandlers(),
                                                                      PipelineTest.CreatePostRequestHandlers(),
                                                                      null));

            Assert.AreEqual("Value cannot be null. (Parameter 'finishRequestHandlers')", exception.Message);
        }
예제 #2
0
        public void ConstructorIfRequestHandlerIsNullShouldThrowExceptionTest()
        {
            // Act & Assert
            var exception = Assert.Throws <ArgumentNullException>(() => new Pipeline <TestRequest, object>(
                                                                      null,
                                                                      PipelineTest.CreatePreRequestHandlers(),
                                                                      PipelineTest.CreatePostRequestHandlers(),
                                                                      PipelineTest.CreateFinishRequestHandlers()));

            Assert.AreEqual("Value cannot be null. (Parameter 'requestHandler')", exception.Message);
        }
예제 #3
0
        public void ConstructorTest()
        {
            // Arrange & Act
            var pipeline = new Pipeline <TestRequest, object>(
                Substitute.For <IRequestHandler <TestRequest, object> >(),
                PipelineTest.CreatePreRequestHandlers(),
                PipelineTest.CreatePostRequestHandlers(),
                PipelineTest.CreateFinishRequestHandlers());

            // Assert
            Assert.IsNotNull(pipeline);
            Assert.IsNotNull(pipeline.RequestHandler);
            Assert.IsNotEmpty(pipeline.PreRequestHandlers);
            Assert.IsNotEmpty(pipeline.PostRequestHandlers);
            Assert.IsNotEmpty(pipeline.FinishRequestHandlers);
        }