public void CanMakeArbitraryKeysToConcreteTypes() { MockBuilderContext context = new MockBuilderContext(); context.Policies.Set <IBuildKeyMappingPolicy>(new BuildKeyMappingPolicy(typeof(Foo)), "bar"); BuildKeyMappingStrategy strategy = new BuildKeyMappingStrategy(); context.Strategies.Add(strategy); SpyStrategy spy = new SpyStrategy(); context.Strategies.Add(spy); strategy.BuildUp(context, "bar", null); Assert.Equal <object>(typeof(Foo), spy.BuildKey); }
public void CanMapGenericsWithIdenticalGenericParameters() { MockBuilderContext context = new MockBuilderContext(); context.Policies.Set <IBuildKeyMappingPolicy>(new BuildKeyMappingPolicy(typeof(Foo <>)), typeof(IFoo <>)); BuildKeyMappingStrategy strategy = new BuildKeyMappingStrategy(); context.Strategies.Add(strategy); SpyStrategy spy = new SpyStrategy(); context.Strategies.Add(spy); strategy.BuildUp(context, typeof(IFoo <int>), null); Assert.Equal <object>(typeof(Foo <int>), spy.BuildKey); }