本文整理汇总了C#中Rule.Fire方法的典型用法代码示例。如果您正苦于以下问题:C# Rule.Fire方法的具体用法?C# Rule.Fire怎么用?C# Rule.Fire使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rule
的用法示例。
在下文中一共展示了Rule.Fire方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReplaceCurrentPosition
public void ReplaceCurrentPosition(Tag tag, Rule rule)
{
EndReplacement end = new EndReplacement(Position, tag, rule);
Content newContent = rule.Fire(this);
Content.RemoveAt(Position);
Content.InsertRange(Position, newContent);
Content.Insert(Position + newContent.Count, end);
}
示例2: SimpleRuleFireTest
public void SimpleRuleFireTest ()
{
//given
var rule = new Rule (@"When(""knopje"").IsPushed().Switch(""lampje"")", new[] { "knopje", "lampje" });
Distributor.RuleStores.First ().AddRule (rule);
Distributor.ExternalSources.First().Connections.First(c => c.Name == "knopje").CurrentState = "in";
rule.LastTriggered = DateTime.Now.Ticks;
//when
var chd = rule.Fire(new Connection("knopje", ConnectionType.In) { CurrentState = "in" }, "out").ToList();
//then
Assert.AreEqual("lampje",chd.First().Connection.Name);
Assert.AreEqual("on", chd.First().NewState.Name);
}