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


C# C1.M方法代码示例

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


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

示例1: Check

		protected override void Check()
		{
			var c1 = new C1();
			var c2 = new C2();
			var m = new Model();
			m.AddRootComponents(c1, c2);
			m.Seal();

			{
				var actual = (LtlFormula)(0 == c1.M(17) - 2);
				var expected = new StateFormula(
					new BinaryExpression(BinaryOperator.Equals,
						new IntegerLiteralExpression(0),
						new BinaryExpression(BinaryOperator.Subtract,
							new MethodInvocationExpression(
								m.Metadata.RootComponent.Subcomponents[0].ProvidedPorts[1],
								new ArgumentExpression(new IntegerLiteralExpression(17), RefKind.None)),
							new IntegerLiteralExpression(2))
						));

				Check(actual, expected);
			}

			{
				var actual = c1.F;
				var expected = new StateFormula(
					new BinaryExpression(BinaryOperator.Equals,
						new MethodInvocationExpression(m.Metadata.RootComponent.Subcomponents[0].ProvidedPorts[2]),
						new MethodInvocationExpression(m.Metadata.RootComponent.Subcomponents[0].ProvidedPorts[3],
							new ArgumentExpression(new IntegerLiteralExpression(1), RefKind.None),
							new ArgumentExpression(new BooleanLiteralExpression(true), RefKind.None))));

				Check(actual, expected);
			}

			{
				var actual = (LtlFormula)(c2.M3());
				var expected = new StateFormula(new MethodInvocationExpression(m.Metadata.RootComponent.Subcomponents[1].ProvidedPorts[6]));

				Check(actual, expected);
			}

			{
				var ic = c2;
				var actual = (LtlFormula)(ic.M3());
				var expected = new StateFormula(new MethodInvocationExpression(m.Metadata.RootComponent.Subcomponents[1].ProvidedPorts[6]));

				Check(actual, expected);
			}

			{
				var ic = c2;
				var actual = ((LtlFormula)(ic.M3())).Formula.InlineMethodInvocations();
				var expected = new StateFormula(new BooleanLiteralExpression(false));

				Check(actual, expected);
			}

			{
				var actual = (LtlFormula)(c2.M(1) == 1);
				var expected = new StateFormula(
					new BinaryExpression(BinaryOperator.Equals,
						new MethodInvocationExpression(m.Metadata.RootComponent.Subcomponents[1].ProvidedPorts[5],
							new ArgumentExpression(new IntegerLiteralExpression(1), RefKind.None)),
						new IntegerLiteralExpression(1)));

				Check(actual, expected);
			}

			Tests.Raises<InvalidOperationException>(() => ((LtlFormula)(c2.M4(111) == 81)).Formula.InlineMethodInvocations());
		}
开发者ID:cubeme,项目名称:safety-sharp,代码行数:71,代码来源:method+access.cs


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