问题描述
我正在使用xunit来测试我的项目。我添加了所有依赖项但我收到了以下错误。
找不到类型或命名空间名称'TestServer'(您是否缺少using指令或程序集引用?)
我的test3.Tests.csproj依赖项
< itemgroup>
< PackageReference Include =Microsoft.AspNetCore.TestHostVersion =2.2.0/>
< PackageReference Include =Microsoft.NET.Test.SdkVersion = 15.9.0/>
< PackageReference Include =xunitVersion =2.4.0/>
< PackageReference Include =xunit.runner .visualstudioVersion =2.4.0/>
我的尝试:
我通过使用dotnet恢复来修复项目。但我收到同样的错误信息。
我该如何解决这个问题。任何人都试着帮我谢谢你..
I am using xunit for testing my project. I was added all dependencies but i am getting following error.
The type or namespace name 'TestServer' could not be found (are you missing a using directive or an assembly reference?)
My test3.Tests.csproj dependencies
<itemgroup>
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="2.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
What I have tried:
I was retore the project by using dotnet restore. But i am getting same error message.
How can i resolve the problem.Any one try to help me thank you..
推荐答案
using Xunit;
在现有的之后使用
语句
这篇关于如何在xunit测试中解决testserver问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!