当前位置: 首页>>代码示例>>C#>>正文


C# Parameter.setTypeName方法代码示例

本文整理汇总了C#中Parameter.setTypeName方法的典型用法代码示例。如果您正苦于以下问题:C# Parameter.setTypeName方法的具体用法?C# Parameter.setTypeName怎么用?C# Parameter.setTypeName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Parameter的用法示例。


在下文中一共展示了Parameter.setTypeName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestParameterTypeName_RelativePath

        public void TestParameterTypeName_RelativePath()
        {
            Dictionary dictionary = CreateDictionary("Test");
            NameSpace nameSpace = CreateNameSpace(dictionary, "N1");
            NameSpace subNameSpace = CreateNameSpace(nameSpace, "N2");

            Enum enumeration = CreateEnum(subNameSpace, "Enum");
            EnumValue value1 = CreateEnumValue(enumeration, "First");
            EnumValue value2 = CreateEnumValue(enumeration, "Second");

            Function function = CreateFunction(nameSpace, "F1", "Boolean");

            Parameter param = new Parameter();
            param.setTypeName("N2.Enum");
            param.setName("Value");
            function.appendParameters(param);

            Case cas1 = CreateCase(function, "Case 1", "True", "Value == N2.Enum.First");
            Case cas2 = CreateCase(function, "Case 2", "False");

            Dictionary dictionary2 = CreateDictionary("TestUpdate");
            dictionary2.setUpdates(dictionary.Guid);

            Function updatedFunction = function.CreateFunctionUpdate(dictionary2);
            Case cas3 = (Case) updatedFunction.Cases[0];
            PreCondition preCondition = (PreCondition) cas3.PreConditions[0];
            preCondition.ExpressionText = "Value == N2.Enum.Second";

            Compiler.Compile_Synchronous(true);

            RuleCheckerVisitor ruleChecker = new RuleCheckerVisitor(dictionary2);
            ruleChecker.visit(updatedFunction);
            Assert.IsNull(ErrorMessage(updatedFunction));

            Expression expression = Parser.Expression(dictionary, "N1.F1(N1.N2.Enum.Second)");
            IValue value = expression.GetValue(new InterpretationContext(), null);
            Assert.AreEqual(System.BoolType.True, value);
        }
开发者ID:JamesOakey,项目名称:ERTMSFormalSpecs,代码行数:38,代码来源:UpdateFunctionTest.cs

示例2: TestParameterTypeReference

        public void TestParameterTypeReference()
        {
            Dictionary dictionary = CreateDictionary("Test");
            NameSpace nameSpace = CreateNameSpace(dictionary, "N1");

            Enum enumeration = CreateEnum(nameSpace, "Enum");
            EnumValue value1 = CreateEnumValue(enumeration, "First");

            Function function = CreateFunction(nameSpace, "f", "Bool");

            Parameter param = new Parameter();
            param.setTypeName("N1.Enum");
            param.setName("Value");

            function.appendParameters(param);
            Case cas1 = CreateCase(function, "Case 1", "True", "Value == Enum.First");

            Dictionary dictionary2 = CreateDictionary("TestUpdate");
            dictionary2.setUpdates(dictionary.Guid);

            Function updatedFunction = function.CreateFunctionUpdate(dictionary2);
            Case cas3 = (Case) updatedFunction.Cases[0];
            cas3.ExpressionText = "False";

            Compiler.Compile_Synchronous(true);

            Expression expression = Parser.Expression(dictionary, "N1.f(N1.Enum.First)");
            IValue value = expression.GetValue(new InterpretationContext(), null);
            Assert.AreEqual(System.BoolType.False, value);
        }
开发者ID:JamesOakey,项目名称:ERTMSFormalSpecs,代码行数:30,代码来源:UpdateFunctionTest.cs


注:本文中的Parameter.setTypeName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。