Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net 如何迁移ExpectedException';s语法从NUnit 2.2.9到2.6.3_Vb.net_Nunit - Fatal编程技术网

Vb.net 如何迁移ExpectedException';s语法从NUnit 2.2.9到2.6.3

Vb.net 如何迁移ExpectedException';s语法从NUnit 2.2.9到2.6.3,vb.net,nunit,Vb.net,Nunit,在使用NUnit 2.2.9的旧代码中,ExpectedException如下所示: <Test(), ExpectedException(GetType(System.Exception), "ExpectedErrorMessage")> Public Sub TestCase ' Some test case End Sub 公共子测试用例 “一些测试案例 端接头 根据一些最终提供了答案的研究,我得出以下结论: <Test(), ExpectedExcepti

在使用NUnit 2.2.9的旧代码中,ExpectedException如下所示:

<Test(), ExpectedException(GetType(System.Exception), "ExpectedErrorMessage")> Public Sub TestCase
    ' Some test case
End Sub
公共子测试用例
“一些测试案例
端接头
根据一些最终提供了答案的研究,我得出以下结论:

<Test(), ExpectedException(GetType(System.Exception), ExpectedMessage = "ExpectedErrorMessage")>

这会产生错误:“ExpectedMessage”未声明。由于其保护级别,可能无法访问


我使用的是NUnit 2.6.3.13283,导入方式如下:
导入NUnit.Framework
访问命名参数的语法错误。在VB.Net中应该是这样的:

<Test(), ExpectedException(GetType(System.Exception), ExpectedMessage:="asdf")>

据此,此命名参数(ExpectedMessage)应可用。也许我在翻译到vb.net时遗漏了一些东西。。。