如何在xunit测试中解决testserver问题? [英] How to resolve the testserver problem in xunit test?

查看:278
本文介绍了如何在xunit测试中解决testserver问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用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..

推荐答案

尝试使用 Xunit添加此
Try adding this
using Xunit;

在现有的之后使用语句


这篇关于如何在xunit测试中解决testserver问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆