public void add_type_adds_a_plugin_for_type_once_and_only_once()
        {
            var graph = new PluginGraph();

            graph.AddType(typeof(IThingy), typeof(BigThingy));

            PluginFamily family = graph.FindFamily(typeof(IThingy));

            family.PluginCount.ShouldEqual(1);
            family.FindPlugin(typeof(BigThingy)).ShouldNotBeNull();

            graph.AddType(typeof(IThingy), typeof(BigThingy));

            family.PluginCount.ShouldEqual(1);
        }
Esempio n. 2
0
 public void Process(Type type, PluginGraph graph)
 {
     if (typeof(IEndpoint).IsAssignableFrom(type))
     {
         graph.AddType(type);
         TransportTypes.Add(type);
     }
 }
Esempio n. 3
0
        public void add_type_adds_an_instance_for_type_once_and_only_once()
        {
            var graph = new PluginGraph();

            graph.AddType(typeof(IThingy), typeof(BigThingy));

            var family = graph.Families[typeof(IThingy)];

            family.Instances
            .Single()
            .ShouldBeOfType <ConstructorInstance>()
            .PluggedType.ShouldBe(typeof(BigThingy));

            graph.AddType(typeof(IThingy), typeof(BigThingy));

            family.Instances.Count().ShouldBe(1);
        }
Esempio n. 4
0
    public void Process(Type type, PluginGraph graph)
    {
        graph.AddType(type);
        var family = graph.FindFamily(type);

        family.AddType(type);
        family.SetScopeTo(InstanceScope.Hybrid);
    }
Esempio n. 5
0
 public void Process(Type type, PluginGraph graph)
 {
     if (CanBeCast(typeof(IController), type))
     {
         string name = type.Name.Replace("Controller", "").ToLower();
         graph.AddType(typeof(IController), type, name);
     }
 }
Esempio n. 6
0
        public void Process(Type type, PluginGraph graph)
        {
            Type pluginType = type.FindInterfaceThatCloses(this._openType);

            if (pluginType != null)
            {
                graph.AddType(pluginType, type);
            }
        }
    public void Process(Type type, PluginGraph graph)
    {
        Type interfaceType = type.FindInterfaceThatCloses(typeof(IConsumer <>));

        if (interfaceType != null)
        {
            graph.AddType(interfaceType, type);
        }
    }
        public void Process(Type type, PluginGraph graph)
        {
            if (!IsConcrete(type))
            {
                return;
            }

            Type pluginType = FindPluginType(type);

            if (pluginType != null && Constructor.HasConstructors(type))
            {
                graph.AddType(pluginType, type);

                //var family = graph.FindFamily(type);
                //family.AddType(pluginType, pluginType.AssemblyQualifiedName);
                //family.SetScopeTo(_instanceScope);
            }
        }
Esempio n. 9
0
 public void Process(Type type, PluginGraph graph)
 {
     graph.AddType(type);
     graph.Configure(a => a.ForRequestedType(type).CacheBy(StructureMap.Attributes.InstanceScope.Hybrid));
 }