Ejemplo n.º 1
0
        public void accept_a_visitor_with_interception_and_a_simpler_inner_builder()
        {
            var mocks = new MockRepository();

            var visitor      = mocks.StrictMock <IBuildPlanVisitor>();
            var inner        = mocks.StrictMock <IDependencySource>();
            var interception = mocks.StrictMock <IInterceptionPlan>();


            var plan = new BuildPlan(typeof(IGateway), new ObjectInstance(new StubbedGateway()), inner, interception);

            using (mocks.Ordered())
            {
                visitor.Instance(plan.PluginType, plan.Instance);
                interception.AcceptVisitor(visitor);
                visitor.InnerBuilder(inner);
            }

            mocks.ReplayAll();

            using (mocks.Playback())
            {
                plan.AcceptVisitor(visitor);
            }
        }
Ejemplo n.º 2
0
        public void accept_a_visitor_with_no_interception_and_a_visitable_inner()
        {
            var mocks = new MockRepository();

            var visitor = mocks.StrictMock <IBuildPlanVisitor>();
            var inner   = mocks.StrictMultiMock <IDependencySource>(typeof(IBuildPlanVisitable));

            var plan = new BuildPlan(typeof(IGateway), new ObjectInstance(new StubbedGateway()), inner, null);

            using (mocks.Ordered())
            {
                visitor.Instance(plan.PluginType, plan.Instance);
                inner.As <IBuildPlanVisitable>().AcceptVisitor(visitor);
            }

            mocks.ReplayAll();

            using (mocks.Playback())
            {
                plan.AcceptVisitor(visitor);
            }
        }