本文整理汇总了C#中FakeAssert.Throws方法的典型用法代码示例。如果您正苦于以下问题:C# FakeAssert.Throws方法的具体用法?C# FakeAssert.Throws怎么用?C# FakeAssert.Throws使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FakeAssert
的用法示例。
在下文中一共展示了FakeAssert.Throws方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: throw_exception_generics_com_delegate_e_mensagem
public void throw_exception_generics_com_delegate_e_mensagem()
{
string errorMessage = "message";
string throwingMessage = string.Empty;
try
{
FakeAssert assert = new FakeAssert();
TestDelegate test = new TestDelegate(FazerNada);
assert.Throws<Exception>(test, errorMessage);
}
catch (Exception ex)
{
throwingMessage = ex.Message;
}
Assert.AreEqual(throwingMessage, errorMessage);
}
示例2: throws_type__nao_deve_retornar_execao
public void throws_type__nao_deve_retornar_execao()
{
IAssert Assert = new FakeAssert();
object[] lista = new object[0];
Type expression = typeof(IAssert);
TestDelegate test = new TestDelegate(FazerNada);
Assert.Throws(expression, test);
}
示例3: throw_exception_com_generics_utilizando_delegate_com_mensagem_e_array_de_parametros
public void throw_exception_com_generics_utilizando_delegate_com_mensagem_e_array_de_parametros()
{
string errorMessage = "message";
string throwingMessage = string.Empty;
try
{
IAssert assert = new FakeAssert();
ResolvableConstraintExpression expression = new ResolvableConstraintExpression();
TestDelegate test = new TestDelegate(FazerNada);
assert.Throws<Exception>(test, errorMessage, true, true, true, true, true);
}
catch (Exception ex)
{
throwingMessage = ex.Message;
}
Assert.AreEqual(throwingMessage, errorMessage);
}
示例4: throws_nao_deve_retornar_execao
public void throws_nao_deve_retornar_execao()
{
IAssert Assert = new FakeAssert();
object[] lista = new object[0];
ResolvableConstraintExpression expression = new ResolvableConstraintExpression();
TestDelegate test = new TestDelegate(FazerNada);
Assert.Throws(expression, test);
}