本文整理汇总了C#中TestFilter.LinkTo方法的典型用法代码示例。如果您正苦于以下问题:C# TestFilter.LinkTo方法的具体用法?C# TestFilter.LinkTo怎么用?C# TestFilter.LinkTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestFilter
的用法示例。
在下文中一共展示了TestFilter.LinkTo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Then_exception_is_registered
public void Then_exception_is_registered()
{
List<string> flowResult = new List<string>();
TestFilter first = new TestFilter(m => { });
TestFilter second = new TestFilter(m => { flowResult.Add(m["data"]); },
m => { if (m["data"] == "A") throw new Exception(); });
first.LinkTo(second);
first.ProcessMessage(new NuntiusMessage() { ["data"] = "A" });
first.ProcessMessage(new NuntiusMessage() { ["data"] = "B" });
Task.Delay(20).Wait();
Assert.AreEqual(1, _handlerCalledCount);
Task.Delay(20).Wait();
Assert.AreEqual(1, flowResult.Count);
Assert.AreEqual("B", flowResult[0]);
}
示例2: Initialize
public void Initialize()
{
Initialize_exception_handler();
exceptionHandler += m => _exceptionMessage = m;
NuntiusConfiguration.Exception += exceptionHandler;
NuntiusConfiguration.CommunicationExceptionStrategy = CommunicationExceptionStrategy.StopFlow;
_result = new List<string>();
_first = new TestFilter(EventSourceCallbackMonitoringOptions.CheckTaskException, m => { });
_second = new TestFilter(EventSourceCallbackMonitoringOptions.CheckTaskException, m => { if (m["data"] == "B") throw new Exception(); });
_third = new TestFilter(EventSourceCallbackMonitoringOptions.CheckTaskException, m => { _result.Add(m["data"]); });
_first.LinkTo(_second).LinkTo(_third);
}
示例3: Then_proper_exception_message_is_returned
public void Then_proper_exception_message_is_returned()
{
TestFilter first = new TestFilter(m => { });
TestFilter second = new TestFilter(m => { }, m => { if (m["data"] == "A") throw new Exception(); });
first.LinkTo(second);
first.ProcessMessage(new NuntiusMessage() { ["data"] = "A" });
first.ProcessMessage(new NuntiusMessage() { ["data"] = "B" });
Task.Delay(50).Wait();
Assert.AreEqual(first, distributedException.ExceptionCatcher);
Assert.AreEqual(CommunicationExceptionOrigin.ProcessHandler, distributedException.ExceptionOrigin);
Assert.AreEqual("A", distributedException.MessageCausingException["data"]);
}