Beispiel #1
0
 public VisualizationPageCache(IConfiguration config, INodeInstanceCache nodeInstanceCache, ICategoryCache categoryCache, IAreaCache areaCache, ILogicInstanceCache logicInstanceCache) : base(config)
 {
     _nodeInstanceCache  = nodeInstanceCache;
     _categoryCache      = categoryCache;
     _areaCache          = areaCache;
     _logicInstanceCache = logicInstanceCache;
 }
Beispiel #2
0
 public LogicCacheFacade(ILogicInstanceCache instanceCache, ILogicPageCache pageCache, ILogicTemplateCache templateCache, ILinkCache linkCache)
 {
     _linkCache    = linkCache;
     InstanceCache = instanceCache;
     PageCache     = pageCache;
     TemplateCache = templateCache;
 }
        public static async Task <LogicMock> CreateLogicMock(
            string name,
            IDispatcher dispatcher,
            ILogicInstanceCache instanceCache,
            ILogicInterfaceInstanceCache interfaceInstanceCache,
            ILogicInstancesStore logicInstances)
        {
            var ruleInstance = new RuleInstance
            {
                ObjId = Guid.NewGuid(),
                Name  = "Logic_" + name
            };

            var inputTemplate = new RuleInterfaceTemplate
            {
                ObjId               = Guid.NewGuid(),
                Name                = "Input",
                ParameterDataType   = RuleInterfaceParameterDataType.Integer,
                IsLinkableParameter = true
            };

            var input = new RuleInterfaceInstance
            {
                ObjId = Guid.NewGuid(),
                This2RuleInstanceNavigation          = ruleInstance,
                This2RuleInstance                    = ruleInstance.ObjId,
                This2RuleInterfaceTemplateNavigation = inputTemplate,
                This2RuleInterfaceTemplate           = inputTemplate.ObjId
            };


            var outputTemplate = new RuleInterfaceTemplate
            {
                ObjId               = Guid.NewGuid(),
                Name                = "Output",
                ParameterDataType   = RuleInterfaceParameterDataType.Integer,
                IsLinkableParameter = true
            };
            var output = new RuleInterfaceInstance
            {
                ObjId = Guid.NewGuid(),
                This2RuleInstanceNavigation          = ruleInstance,
                This2RuleInstance                    = ruleInstance.ObjId,
                This2RuleInterfaceTemplateNavigation = outputTemplate,
                This2RuleInterfaceTemplate           = outputTemplate.ObjId
            };

            ruleInstance.RuleInterfaceInstance.Add(input);
            ruleInstance.RuleInterfaceInstance.Add(output);

            var mock = new LogicMock(new RuleContextMock(ruleInstance, dispatcher));

            await mock.Start();

            instanceCache?.Add(ruleInstance.ObjId, ruleInstance);
            interfaceInstanceCache?.Add(input.ObjId, input);
            interfaceInstanceCache?.Add(output.ObjId, output);
            logicInstances?.Add(ruleInstance, mock);

            return(mock);
        }