コード例 #1
0
        public void Add_instance_that_does_not_exist_in_destination()
        {
            var source = new PluginFamily(typeof (IWidget));
            var sourceInstance = new ObjectInstance(new AWidget());
            source.AddInstance(sourceInstance);

            var destination = new PluginFamily(typeof (IWidget));
            destination.ImportFrom(source);

            Assert.AreSame(sourceInstance, destination.GetInstance(sourceInstance.Name));
        }
コード例 #2
0
        public void Do_not_override_named_instance()
        {
            var source = new PluginFamily(typeof (IWidget));
            ObjectInstance sourceInstance = new ObjectInstance(new AWidget()).WithName("New");
            source.AddInstance(sourceInstance);

            var destination = new PluginFamily(typeof (IWidget));
            ObjectInstance destinationInstance = new ObjectInstance(new AWidget()).WithName("New");
            destination.AddInstance(destinationInstance);

            destination.ImportFrom(source);

            Assert.AreSame(destinationInstance, destination.GetInstance(sourceInstance.Name));
        }
コード例 #3
0
        public void ImportFrom(PluginFamily sourceFamily)
        {
            PluginFamily destinationFamily = FindFamily(sourceFamily.PluginType);

            destinationFamily.ImportFrom(sourceFamily);
        }