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

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

            graph.HasDefaultForPluginType(typeof(IThingy));
        }
Exemplo 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();
        }
Exemplo n.º 3
0
 public Instance GetDefault(Type pluginType)
 {
     return(_pluginGraph.HasDefaultForPluginType(pluginType)
         ? _pluginGraph.Families[pluginType].GetDefaultInstance()
         : _parent.Instances.GetDefault(pluginType));
 }
Exemplo n.º 4
0
        public void has_default_when_the_family_has_not_been_created()
        {
            var graph = new PluginGraph();

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