예제 #1
0
 public void Configure(FubuRegistry registry)
 {
     // Some ugly Generic trickery
     registry.WithTypes(types => types.TypesMatching(IsGridDefinitionType).Each(type =>
     {
         typeof(Loader <>).CloseAndBuildAs <ILoader>(type).Apply(registry);
     }));
 }
예제 #2
0
        public void smoke_test_the_with_types()
        {
            var registry = new FubuRegistry();

            registry.Applies.ToThisAssembly();
            registry.WithTypes(types =>
            {
                types.TypesMatching(x => x.IsConcreteTypeOf <MyInterface>()).Each(type =>
                {
                    registry.Services(s => s.AddService(typeof(MyInterface), new ObjectDef(type)));
                });
            });

            registry.BuildGraph().Services.ServicesFor <MyInterface>()
            .Single().Type.ShouldEqual(typeof(MyConcreteClass));
        }