public void ListConfigFromJson() { JObject o = JObject.Parse(@"{ nodesLoader :{ targetIdentifier: 'nodeId', whiteList : ['ciao'], blackList : ['pippo'], contains : ['kola'], notContain :[] } }"); config = o.ToObject <nodesConfigWrapper>().nodesLoader; Console.WriteLine("not contain {0}", config.notContain.Length); NodesSelector sel = new NodesSelector(config); node.NodeId = "paul"; Assert.False(sel.selectNode(node), "Wrong nodeId should fail"); node.NodeId = "ciao"; Assert.True(sel.selectNode(node), "nodeId should pass"); node.NodeId = "pippo"; Assert.False(sel.selectNode(node), "blacklisted nodeId should fail"); node.NodeId = "hey kola"; Assert.True(sel.selectNode(node), "contained nodeId should pass"); Assert.True(config.notContain.Length == 0, "fail to initialize empty array"); Assert.True(config.matchRegEx.Length == 0, "fail to initialize empty array 2"); }
public opcPromConfig() { port = 9988; systemLabelValue = ""; systemLabelName = ""; failDefaultValue = -999; variableFilter = new nodesConfig(); }
public nodeSelectorTest() { node = new Opc.Ua.Export.UAVariable(); node.BrowseName = "paul"; config = new nodesConfig(); config.targetIdentifier = "browseName"; /* * var log = new NLog.Config.LoggingConfiguration(); * var logconsole = new NLog.Targets.ColoredConsoleTarget("logconsole"); * // Rules for mapping loggers to targets * log.AddRule( LogLevel.Debug, LogLevel.Fatal, logconsole); * // Apply config * NLog.LogManager.Configuration = log; */ }