简体   繁体   English

无法通过测试单元测试生成器找到我的课程

[英]Cant find my class with testing Unit Test Generator

I know how to write simple unit tests.我知道如何编写简单的单元测试。 My problem is that I can't find my class in the unit test project.我的问题是我在单元测试项目中找不到我的班级。 I have imported the referens to the other project that I want to test.我已将引用导入到我要测试的另一个项目。

I can't do Generate unit test when I right click and I can't even create an object on the class connection.cs that's in the project that I have used referens to.当我右键单击时,我无法执行生成单元测试,我什至无法在我使用引用的项目中的类 connection.cs 上创建对象。

I have the addon (Unit Test Generator) and I can do it on some methods in the usercontrol class but that class uses my connection.cs that I want to do testing on.我有插件(单元测​​试生成器),我可以在 usercontrol 类中的某些方法上执行它,但该类使用我想要对其进行测试的 connection.cs。

Anyone have any idea whats the problem任何人都知道有什么问题

单元测试图片

1st第一

Make sure your class is Public确保您的课程是Public

2nd第二

If you have a constructor .如果你有一个constructor Declaring the constructor public can fix this problem将构造函数声明为public可以解决这个问题

Though the constructors have no name only a type虽然constructors没有name只有一个type

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

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