本文整理汇总了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());
}