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); }
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); }