Exemple #1
0
 public DomainNodeRenderer(ConversationNode node, PointF p, Func <Id <LocalizedStringType>, Id <LocalizedText>, string> localizer)
     : base(node, p)
 {
     m_titleSection      = new TitleSection(node);
     m_outputsSection    = new OutputsSection(node);
     m_parametersSection = new ParametersSection(node, localizer);
 }
Exemple #2
0
 public EditableUI(ConversationNode node, PointF p, Func <Id <LocalizedStringType>, Id <LocalizedText>, string> localizer)
     : base(node, p)
 {
     m_titleSection = new TitleSection(node);
     //m_descriptionSection = new DescriptionSection(node);
     m_outputsSection    = new OutputsSection(node);
     m_parametersSection = new ParametersSection(node, localizer, ShouldRender);
     m_rounded           = RoundedConfig.TryGet(Node.Data.Config) ?? false;
 }
        public NameValueCollection ServerToClientRequestParameters(NameValueCollection serverParameters)
        {
            var config = ParametersSection.GetSection();

            var result = new NameValueCollection(serverParameters);

            RemoveIgnoredParameters(result, config.Client.IgnoreRules.ToList());
            ApplyParameterMappings(result, config.Client.MappingRules.ToDictionary());
            AddRequiredParameters(result, config.Client.RequireRules.ToDictionary());

            return(result);
        }
        public NameValueCollection ClientToServerRequestParameters(NameValueCollection clientParameters)
        {
            var config = ParametersSection.GetSection();

            var result = new NameValueCollection(clientParameters);

            RemoveIgnoredParameters(result, config.Server.IgnoreRules.ToList());
            ApplyParameterMappings(result, config.Server.MappingRules.ToDictionary());
            EnsureChannelParameter(result);
            AddRequiredParameters(result, config.Server.RequireRules.ToDictionary());

            return(result);
        }
 public virtual T Visit(ParametersSection node)
 {
     Visit((Section)node);
     return(traverse(node.returnVar));
 }
        public void TestParametersSection()
        {
            var section = ParametersSection.GetSection();

            Assert.IsNotNull(section);

            #region Test server settings

            var expectedServerIgnore = new List <string>()
            {
                "sid",
                "password",
                "username",
                "timestamp",
            };

            Assert.AreEqual(expectedServerIgnore.Count, section.Server.IgnoreRules.Count);
            foreach (var rawRule in section.Server.IgnoreRules)
            {
                var rule = rawRule as IgnoreRuleElement;
                Assert.IsTrue(expectedServerIgnore.Contains(rule.Name));
            }

            var expectedServerRequire = new Dictionary <string, string>();

            Assert.AreEqual(expectedServerRequire.Count, section.Server.RequireRules.Count);
            foreach (var rawRule in section.Server.RequireRules)
            {
                var rule = rawRule as RequireRuleElement;
                Assert.IsTrue(expectedServerRequire[rule.Name] == rule.Default);
            }

            var expectedServerMappings = new Dictionary <string, string>()
            {
                { "keywords", "query" },
            };

            Assert.AreEqual(expectedServerMappings.Count, section.Server.MappingRules.Count);
            foreach (var rawRule in section.Server.MappingRules)
            {
                var rule = rawRule as MappingRuleElement;
                Assert.IsTrue(expectedServerMappings[rule.Name] == rule.MapTo);
            }

            #endregion

            #region Test client settings

            var expectedClientIgnore = new List <string>()
            {
                "xml",
                "format",
                "channel",
                "password",
                "username",
                "timestamp",
            };

            Assert.AreEqual(expectedClientIgnore.Count, section.Client.IgnoreRules.Count);
            foreach (var rawRule in section.Client.IgnoreRules)
            {
                var rule = rawRule as IgnoreRuleElement;
                Assert.IsTrue(expectedClientIgnore.Contains(rule.Name));
            }

            var expectedClientRequire = new Dictionary <string, string>()
            {
                { "test", "value" },
            };

            Assert.AreEqual(expectedClientRequire.Count, section.Client.RequireRules.Count);
            foreach (var rawRule in section.Client.RequireRules)
            {
                var rule = rawRule as RequireRuleElement;
                Assert.IsTrue(expectedClientRequire[rule.Name] == rule.Default);
            }

            var expectedClientMappings = new Dictionary <string, string>()
            {
                { "query", "keywords" },
            };

            Assert.AreEqual(expectedClientMappings.Count, section.Client.MappingRules.Count);
            foreach (var rawRule in section.Client.MappingRules)
            {
                var rule = rawRule as MappingRuleElement;
                Assert.IsTrue(expectedClientMappings[rule.Name] == rule.MapTo);
            }

            #endregion
        }
Exemple #7
0
 public override bool Visit(ParametersSection node)
 {
     Visit((Section)node);
     TraversePrint(node.returnVar);
     return(true);
 }