示例#1
0
 public TestContextualizer()
 {
     reflection = new Fasterflection();
     inner = new DefaultContextualizer(reflection,
                                       new ValueAssignments(new DefaultValueConverterContainer(reflection),
                                                            reflection), reflection);
 }
示例#2
0
 public void it_should_cache_source_implementation_getter_invocations_after_first_call()
 {
     var cache = new Fasterflection();
     var cfg = new DestinationConfigurationContainer(null, new TestConfigurationFactory());
     cfg.Map<Destination>().From<IWorkOkay>();
     var binding = cfg.ToBinding();
     binding.Bind();
     binding.Assert();
     binding.Accept(new CacheInitializer(cache));
     var src = new SourceImplementation() {Name = "mikey"};
     cache.HasCachedGetterFor(typeof(SourceImplementation), "Name").should_be_false();
     var value=cache.GetValue("Name", src);
     cache.HasCachedGetterFor(typeof (SourceImplementation), "Name").should_be_true();
     value.should_be_equal_to("mikey");
 }
示例#3
0
 private IResolutionContext Contextualize(params IConvertValue[] testConverters)
 {
     var reflection = new Fasterflection();
     var converters = new DefaultValueConverterContainer(reflection);
     foreach (var testConverter in testConverters)
     {
         converters.AddConverter(testConverter);
     }
     return new DefaultResolutionContext(src, dest, null, new ValueAssignments(converters, reflection ),reflection);
 }