コード例 #1
0
        public void interfaces_are_applied_correctly()
        {
            var general   = HandlerCall.For <ConcreteHandler>(x => x.General(null));
            var specific1 = HandlerCall.For <ConcreteHandler>(x => x.Specific1(null));
            var specific2 = HandlerCall.For <ConcreteHandler>(x => x.Specific2(null));

            theGraph.Add(general);
            theGraph.Add(specific1);
            theGraph.Add(specific2);

            theGraph.ShouldHaveCount(2);
            theGraph.ApplyGeneralizedHandlers();

            theGraph.ShouldHaveCount(2);

            theGraph.ChainFor(typeof(Concrete1)).Last().ShouldBeOfType <HandlerCall>()
            .InputType().ShouldEqual(typeof(IMessage));

            theGraph.ChainFor(typeof(Concrete2)).Last().ShouldBeOfType <HandlerCall>()
            .InputType().ShouldEqual(typeof(IMessage));
        }