小编Piy*_*ade的帖子

NUnit 3 驱动程序在执行反射代码时遇到错误 (NUnit.Engine.NUnitEngineException)

我有一个简单的 Nunit 项目,其中仅包含一个测试。我想使用命令执行我的代码,因此我在 Windows 10 计算机上安装了 \xe2\x80\x98Nunit-console.exe\xe2\x80\x99 。安装后,使用以下命令在命令提示符下执行代码

\n
nunit3-console.exe "G:\\LiveProjects\\NUnitTestProject2\\NUnitTestProject2\\bin\\Debug\\netcoreapp3.1\\NUnitTestProject2.dll"\nlike so\n
Run Code Online (Sandbox Code Playgroud)\n

执行此命令后,我发现以下错误消息:

\n
NUnit.Engine.NUnitEngineException : The NUnit 3 driver encountered an error while executing reflected code.\n  ----> System.InvalidCastException : Unable to cast transparent proxy to type 'System.Web.UI.ICallbackEventHandler'.\n--NUnitEngineException\nThe NUnit 3 driver encountered an error while executing reflected code.\nlike so\n
Run Code Online (Sandbox Code Playgroud)\n

请参考我下面的代码:

\n
[TestFixture]   \n    public class Tests\n    {\n        [SetUp]\n        public void Setup()\n        {\n\n            Console.WriteLine("Welcome setup");\n\n        }\n\n        [Test]\n        public void Test1()\n        {\n          \n            Console.WriteLine("Welcome first Test ");\n            Assert.Pass();\n        }\n    }\nlike …
Run Code Online (Sandbox Code Playgroud)

.net c# console automation nunit

6
推荐指数
2
解决办法
6340
查看次数

标签 统计

.net ×1

automation ×1

c# ×1

console ×1

nunit ×1