Beispiel #1
0
        public void Can_be_part_of_PluginFamily()
        {
            var target   = new ATarget();
            var instance = new ObjectInstance(target);
            IDiagnosticInstance diagnosticInstance = instance;

            var family1 = new PluginFamily(typeof(ATarget));

            Assert.IsTrue(diagnosticInstance.CanBePartOfPluginFamily(family1));

            var family2 = new PluginFamily(GetType());

            Assert.IsFalse(diagnosticInstance.CanBePartOfPluginFamily(family2));
        }
 private void validateInstance(IDiagnosticInstance instance, PluginFamily family, PluginGraph graph)
 {
     if (!instance.CanBePartOfPluginFamily(family))
     {
         graph.Log.RegisterError(104, instance.CreateToken(), family.PluginType);
     }
 }
        public void Can_be_plugged_in_if_there_is_a_plugged_type_and_the_plugged_type_can_be_cast_to_the_plugintype()
        {
            var instance = new ConfiguredInstance(typeof(ColorWidget));
            var family   = new PluginFamily(typeof(IWidget));

            IDiagnosticInstance diagnosticInstance = instance;

            Assert.IsTrue(diagnosticInstance.CanBePartOfPluginFamily(family));
        }
Beispiel #4
0
        private void validatePluggabilityOfInstances()
        {
            _instances.Each(instance =>
            {
                IDiagnosticInstance diagnosticInstance = instance;

                _parent.Log.Try(() => diagnosticInstance.Preprocess(this))
                .AndReportErrorAs(104, diagnosticInstance.CreateToken(), _pluginType);


                if (!diagnosticInstance.CanBePartOfPluginFamily(this))
                {
                    _parent.Log.RegisterError(104, diagnosticInstance.CreateToken(), _pluginType);
                }
            });
        }