public void FrameworkPlugins_SingleContextGet()
        {
            // engine data objects (not plugin-able business logic)
            Model model = CreateModel();
            var measurement = new Measurement();
            // plugin definition (unique and parameters)
            const string commandUnique = "pluginB_single_get";
            const string commandParameters = "parameter1=P1; parameter2=P2; material1=M1; material2=M2; threshold=0.4";

            var containerFramework = new ContainerFramework();
            var dataFramework = new DataFramework(containerFramework);
            dataFramework.Add<IModelDataEntity>(new ModelDataEntity(model));
            dataFramework.Add<IMeasurementDataEntity>(new MeasurementDataEntity(measurement));

            var commandFramework = new CommandFramework(containerFramework, dataFramework);
            commandFramework.AddPluginsFolder(new DataFolder(@"..\..\..\@PluginsBinaries"));
            commandFramework.AddPluginsBinary(new DataFile(@".\EngineAPI.dll"));
            commandFramework.Init();
//            var service1 = commandFramework.FindPlugin("model_get_measurement_properties").Value as IMeasurementPropertiesService;   //TODO should be implemented automatically
//            commandFramework.RegisterService<IMeasurementPropertiesService>(service1);
//            var service2 = commandFramework.FindPlugin("get_material_properties").Value as IMaterialPropertiesService;   //TODO should be implemented automatically
//            commandFramework.RegisterService<IMaterialPropertiesService>(service2);

            IDataEntity commandResult = commandFramework.RunCommand(commandUnique, commandParameters);
            Assert.IsInstanceOf<ModelParametersDataEntity>(commandResult);
        }
示例#2
0
        public void FrameworkPlugins_Intro()
        {
            // engine data objects (not plugin-able business logic)
            Model model       = CreateModel();
            var   measurement = new Measurement();
            // plugin definition (unique and parameters)
            const string commandUnique     = "pluginB_stright";
            const string commandParameters = "parameter1=P1; parameter2=P2; material1=M1; material2=M2; threshold=0.4";

            var containerFramework = new ContainerFramework();
            var dataFramework      = new DataFramework(containerFramework);

            dataFramework.Add <IModelDataEntity>(new ModelDataEntity(model));
            dataFramework.Add <IMeasurementDataEntity>(new MeasurementDataEntity(measurement));

            var commandFramework = new CommandFramework(containerFramework, dataFramework);

            commandFramework.AddPluginsFolder(new DataFolder(@"..\..\..\@PluginsBinaries"));
            commandFramework.AddPluginsBinary(new DataFile(@".\EngineAPI.dll"));
            commandFramework.Init();

            IDataEntity commandResult = commandFramework.RunCommand(commandUnique, commandParameters);

            Assert.IsInstanceOf <ModelParametersDataEntity>(commandResult);
        }
示例#3
0
        public void FrameworkPlugins_SingleContextGet()
        {
            // engine data objects (not plugin-able business logic)
            Model model       = CreateModel();
            var   measurement = new Measurement();
            // plugin definition (unique and parameters)
            const string commandUnique     = "pluginB_single_get";
            const string commandParameters = "parameter1=P1; parameter2=P2; material1=M1; material2=M2; threshold=0.4";

            var containerFramework = new ContainerFramework();
            var dataFramework      = new DataFramework(containerFramework);

            dataFramework.Add <IModelDataEntity>(new ModelDataEntity(model));
            dataFramework.Add <IMeasurementDataEntity>(new MeasurementDataEntity(measurement));

            var commandFramework = new CommandFramework(containerFramework, dataFramework);

            commandFramework.AddPluginsFolder(new DataFolder(@"..\..\..\@PluginsBinaries"));
            commandFramework.AddPluginsBinary(new DataFile(@".\EngineAPI.dll"));
            commandFramework.Init();
//            var service1 = commandFramework.FindPlugin("model_get_measurement_properties").Value as IMeasurementPropertiesService;   //TODO should be implemented automatically
//            commandFramework.RegisterService<IMeasurementPropertiesService>(service1);
//            var service2 = commandFramework.FindPlugin("get_material_properties").Value as IMaterialPropertiesService;   //TODO should be implemented automatically
//            commandFramework.RegisterService<IMaterialPropertiesService>(service2);

            IDataEntity commandResult = commandFramework.RunCommand(commandUnique, commandParameters);

            Assert.IsInstanceOf <ModelParametersDataEntity>(commandResult);
        }
        public void FrameworkPlugins_Intro()
        {
            // engine data objects (not plugin-able business logic)
            Model model = CreateModel();
            var measurement = new Measurement();            
            // plugin definition (unique and parameters)
            const string commandUnique = "pluginB_stright";
            const string commandParameters = "parameter1=P1; parameter2=P2; material1=M1; material2=M2; threshold=0.4";

            var containerFramework = new ContainerFramework();
            var dataFramework = new DataFramework(containerFramework);
            dataFramework.Add<IModelDataEntity>(new ModelDataEntity(model));
            dataFramework.Add<IMeasurementDataEntity>(new MeasurementDataEntity(measurement));

            var commandFramework = new CommandFramework(containerFramework, dataFramework);
            commandFramework.AddPluginsFolder(new DataFolder(@"..\..\..\@PluginsBinaries"));
            commandFramework.AddPluginsBinary(new DataFile(@".\EngineAPI.dll"));
            commandFramework.Init();

            IDataEntity commandResult = commandFramework.RunCommand(commandUnique, commandParameters);
            Assert.IsInstanceOf<ModelParametersDataEntity>(commandResult);            
        }
 public ChainedDependencyResolver(Type type_to_resolve, ContainerFramework container_framework, ConstructorSelector constructor_selector)
 {
     this.type_to_resolve = type_to_resolve;
     this.container = container_framework;
     this.constructor_selector = constructor_selector;
 }