简体   繁体   English

我在Visual Studio中进行单元测试时遇到麻烦

[英]I am in trouble with unit testing in Visual Studio

I am working on a simple project. 我正在做一个简单的项目。 I added unit test to it. 我添加了单元测试。 When I choose "run all unit test" at the first time it work. 当我第一次选择“运行所有单元测试”时,它将起作用。 But if I choose "run all unit test" at the second time, it pop ups an alert "Specified cast is not valid". 但是,如果我第二次选择“运行所有单元测试”,则会弹出警报“指定的转换无效”。 If I made any modification in the test (even just hit a space) and save it then it works fine again. 如果我在测试中进行了任何修改(甚至只是打了一个空格)并保存了它,那么它又可以正常工作了。 It is a littel bit strange behaviour and very annoying. 这是一个小小的行为,很烦人。

Is it a bug? 是虫子吗? Is there anyone already solved this? 有没有人解决过这个问题?

Could be an issue generated by temporary files. 可能是临时文件产生的问题。

Try right clicking your solution and perform a "Clean solution" and then "Rebuild all". 尝试右键单击您的解决方案,然后执行“清理解决方案”,然后执行“全部重建”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM