本文整理汇总了C#中TestFilter.ProcessMessage方法的典型用法代码示例。如果您正苦于以下问题:C# TestFilter.ProcessMessage方法的具体用法?C# TestFilter.ProcessMessage怎么用?C# TestFilter.ProcessMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestFilter
的用法示例。
在下文中一共展示了TestFilter.ProcessMessage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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"]);
}