我有一个简单的 Nunit 项目,其中仅包含一个测试。我想使用命令执行我的代码,因此我在 Windows 10 计算机上安装了 \xe2\x80\x98Nunit-console.exe\xe2\x80\x99 。安装后,使用以下命令在命令提示符下执行代码
\nnunit3-console.exe "G:\\LiveProjects\\NUnitTestProject2\\NUnitTestProject2\\bin\\Debug\\netcoreapp3.1\\NUnitTestProject2.dll"\nlike so\nRun Code Online (Sandbox Code Playgroud)\n执行此命令后,我发现以下错误消息:
\nNUnit.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\nRun 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)