コード例 #1
0
        public void SetHandlerSuccessor_WhenSetSuccessorIsCalled()
        {
            var concreteHandlerOne = new ConcreteHandlerOne();
            var concreteHandlerTwo = new ConcreteHandlerTwo();

            concreteHandlerOne.SetSuccessor(concreteHandlerTwo);

            concreteHandlerOne.Successor.Should().Be(concreteHandlerTwo);
        }
コード例 #2
0
        public void ReturnOneForRequestsOfTypeOne_WhenHandleRequestIsCalled()
        {
            var requestType = 1;
            var expectedConcreteHandlerNumber = 1;
            var concreteHandlerOne            = new ConcreteHandlerOne();

            var handledBy = concreteHandlerOne.Handle(requestType);

            handledBy.Should().Be(expectedConcreteHandlerNumber);
        }
コード例 #3
0
        public void ReturnMinusOneIfSuccessorIsNotSet_WhenHandleRequestIsCalled()
        {
            var requestType = 2;
            var expectedConcreteHandlerNumber = -1;
            var concreteHandlerOne            = new ConcreteHandlerOne();

            var handledBy = concreteHandlerOne.Handle(requestType);

            handledBy.Should().Be(expectedConcreteHandlerNumber);
        }
コード例 #4
0
        public void ReturnTwoForRequestsOfTypeTwo_WhenHandleRequestIsCalled()
        {
            var requestType = 2;
            var expectedConcreteHandlerNumber = 2;
            var concreteHandlerOne            = new ConcreteHandlerOne();
            var concreteHandlerTwo            = new ConcreteHandlerTwo();

            concreteHandlerOne.SetSuccessor(concreteHandlerTwo);

            var handledBy = concreteHandlerOne.Handle(requestType);

            handledBy.Should().Be(expectedConcreteHandlerNumber);
        }