本文整理汇总了C#中TypeNode.Activate方法的典型用法代码示例。如果您正苦于以下问题:C# TypeNode.Activate方法的具体用法?C# TypeNode.Activate怎么用?C# TypeNode.Activate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TypeNode
的用法示例。
在下文中一共展示了TypeNode.Activate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Only_those_that_are_matched_should_be_called
public void Only_those_that_are_matched_should_be_called()
{
var junction = new JoinNode<Customer>(_constantNode);
junction.AddSuccessor(_actionNode);
var alphaNodeA = new AlphaNode<Customer>();
alphaNodeA.AddSuccessor(junction);
var joinJunction = new JoinNode<Customer>(alphaNodeA);
var alphaNodeB = new AlphaNode<Customer>();
alphaNodeB.AddSuccessor(joinJunction);
var actionNode = new ActionNode<Customer>(x => _secondaryCalled.Complete(x.Element.Object));
var joinJunction2 = new JoinNode<Customer>(alphaNodeA);
joinJunction2.AddSuccessor(actionNode);
var alphaNodeC = new AlphaNode<Customer>();
alphaNodeC.AddSuccessor(joinJunction2);
var tree = new TypeNode<Customer>();
var isPreferred = new ConditionNode<Customer>(x => x.Preferred);
isPreferred.AddSuccessor(alphaNodeA);
tree.AddSuccessor(isPreferred);
tree.AddSuccessor(alphaNodeB);
var isActive = new ConditionNode<Customer>(x => x.Active);
isActive.AddSuccessor(alphaNodeC);
tree.AddSuccessor(isActive);
var visitor = new StringNodeVisitor();
tree.Visit(visitor);
Trace.WriteLine(visitor.Result);
tree.Activate(_context);
_session.Run();
_primaryCalled.IsCompleted.ShouldBeTrue();
_secondaryCalled.IsCompleted.ShouldBeFalse();
}