public void GetFamilyFromIncludeAndMaster()
        {
            PluginGraph graph = buildGraph();


            Assert.IsTrue(graph.ContainsFamily(typeof(IStrategy)));
        }
        public void BuildInstancesOfType()
        {
            var registry = new Registry();

            registry.BuildInstancesOf <IGateway>();
            PluginGraph pluginGraph = registry.Build();

            Assert.IsTrue(pluginGraph.ContainsFamily(typeof(IGateway)));
        }
        public void CanOverrideTheDefaultInstanceAndCreateAnAllNewPluginOnTheFly()
        {
            var registry = new Registry();

            registry.BuildInstancesOf <IGateway>().TheDefaultIsConcreteType <FakeGateway>();
            PluginGraph pluginGraph = registry.Build();

            Assert.IsTrue(pluginGraph.ContainsFamily(typeof(IGateway)));

            var manager = new Container(pluginGraph);
            var gateway = (IGateway)manager.GetInstance(typeof(IGateway));

            Assert.IsInstanceOfType(typeof(FakeGateway), gateway);
        }
        public void TheDefaultInstanceIsPickedUpFromTheAttribute()
        {
            var registry = new Registry();

            registry.BuildInstancesOf <IGateway>();
            registry.Scan(x => x.AssemblyContainingType <IGateway>());

            PluginGraph pluginGraph = registry.Build();

            Assert.IsTrue(pluginGraph.ContainsFamily(typeof(IGateway)));

            var manager = new Container(pluginGraph);
            var gateway = (IGateway)manager.GetInstance(typeof(IGateway));

            Assert.IsInstanceOfType(typeof(DefaultGateway), gateway);
        }
        public void CanOverrideTheDefaultInstance1()
        {
            var registry = new Registry();

            // Specify the default implementation for an interface
            registry.BuildInstancesOf <IGateway>().TheDefaultIsConcreteType <StubbedGateway>();

            PluginGraph pluginGraph = registry.Build();

            Assert.IsTrue(pluginGraph.ContainsFamily(typeof(IGateway)));

            var manager = new Container(pluginGraph);
            var gateway = (IGateway)manager.GetInstance(typeof(IGateway));

            Assert.IsInstanceOfType(typeof(StubbedGateway), gateway);
        }