Esempio n. 1
0
        public void has_default_positive()
        {
            var graph = new PluginGraph();

            graph.Families[typeof(IThingy)].SetDefault(new SmartInstance <BigThingy>());

            graph.HasDefaultForPluginType(typeof(IThingy));
        }
Esempio n. 2
0
        public void has_default_with_family_but_no_default()
        {
            var graph = new PluginGraph();

            graph.Families[typeof(IThingy)].AddInstance(new SmartInstance <BigThingy>());
            graph.Families[typeof(IThingy)].AddInstance(new SmartInstance <BigThingy>());

            graph.HasDefaultForPluginType(typeof(IThingy))
            .ShouldBeFalse();
        }
Esempio n. 3
0
 public Instance GetDefault(Type pluginType)
 {
     return(_pluginGraph.HasDefaultForPluginType(pluginType)
         ? _pluginGraph.Families[pluginType].GetDefaultInstance()
         : _parent.Instances.GetDefault(pluginType));
 }
Esempio n. 4
0
        public void has_default_when_the_family_has_not_been_created()
        {
            var graph = new PluginGraph();

            graph.HasDefaultForPluginType(typeof(IThingy)).ShouldBeFalse();
        }
Esempio n. 5
0
 public bool HasDefaultForPluginType(Type pluginType)
 {
     return(_pluginGraph.HasDefaultForPluginType(pluginType));
 }
Esempio n. 6
0
 public Instance GetDefault(Type pluginType)
 {
     return(_outer.HasDefaultForPluginType(pluginType)
                ? _outer.Families[pluginType].GetDefaultInstance()
                : _parent.GetDefault(pluginType));
 }