本文整理汇总了C#中Chain类的典型用法代码示例。如果您正苦于以下问题:C#Chain类的具体用法?C#Chain怎么用?C#Chain使用的例子?这里精选的类代码示例或许可以为您提供帮助。
示例1:TestExecutionError
publicvoidTestExecutionError()
{
Chain
chain=newChain()
.Link(x=>x)
.Link(x=>
{
if(x==0)
thrownewNullReferenceException(x.ToString());
else
returnx;
})
.Link(x=>100);
ChainExecutionExceptionchEE=null;
try
{
intoutcome=chain.Execute(0);
}
catch(ChainExecutionExceptionchee)
{
chEE=chee;
}
Assert.IsNotNull(chEE);
Assert.AreEqual("0",chEE.InnerException.Message);
}
原文链接:http://www.jxszl.com/biancheng/C/556715.html