예제 #1
0
        public void StrategyGetsBuildPlanFromPolicySet()
        {
            MockBuilderContext context = new MockBuilderContext();
            context.Strategies.Add(new BuildPlanStrategy());
            object instance = new object();
            ReturnInstanceBuildPlan plan = new ReturnInstanceBuildPlan(instance);

            context.Policies.Set<IBuildPlanPolicy>(plan, new NamedTypeBuildKey<object>());

            object result = context.ExecuteBuildUp(new NamedTypeBuildKey<object>(), null);

            Assert.True(plan.BuildUpCalled);
            Assert.Same(instance, result);
        }
예제 #2
0
        public void StrategyGetsBuildPlanFromPolicySet()
        {
            MockBuilderContext context = new MockBuilderContext();

            context.Strategies.Add(new BuildPlanStrategy());
            object instance = new object();
            ReturnInstanceBuildPlan plan = new ReturnInstanceBuildPlan(instance);

            context.Policies.Set <IBuildPlanPolicy>(plan, new NamedTypeBuildKey <object>());

            object result = context.ExecuteBuildUp(new NamedTypeBuildKey <object>(), null);

            Assert.True(plan.BuildUpCalled);
            Assert.Same(instance, result);
        }