Exemple #1
0
        public void Handle_InnerHandleIsCalled()
        {
            IRequestHandler <Request, string> inner = Substitute.For <IRequestHandler <Request, string> >();

            IPreRequestHandler <Request>[]          preRequest  = Substitute.For <List <IPreRequestHandler <Request> > >().ToArray();
            IPostRequestHandler <Request, string>[] postRequest = Substitute.For <List <IPostRequestHandler <Request, string> > >().ToArray();

            MediatorPipeline <Request, string> pipeline = new MediatorPipeline <Request, string>(
                inner,
                preRequest,
                postRequest
                );

            pipeline.Handle(new Request());

            inner.Received().Handle(Arg.Any <Request>());
        }
Exemple #2
0
        public void Handle_PostRequestInnerIsCalled()
        {
            IRequestHandler <Request, string>              inner       = Substitute.For <IRequestHandler <Request, string> >();
            IList <IPreRequestHandler <Request> >          preRequest  = Substitute.For <List <IPreRequestHandler <Request> > >();
            IList <IPostRequestHandler <Request, string> > postRequest = Substitute.For <List <IPostRequestHandler <Request, string> > >();

            postRequest.Add(Substitute.For <IPostRequestHandler <Request, string> >());

            MediatorPipeline <Request, string> pipeline = new MediatorPipeline <Request, string>(
                inner,
                preRequest.ToArray(),
                postRequest.ToArray()
                );

            pipeline.Handle(new Request());

            postRequest[0].Received().Handle(Arg.Any <Request>(), Arg.Any <string>());
        }