Unit test with accessors

[亡魂溺海] 提交于 2019-12-24 16:35:11

问题


This is a two part question.

Background: We moved our C# application from VS2005 to VS2008 and in the process moved the application from .net 2.0 to .net 3.5. The transition went smoothly except for Unit Tests.

First: Is the unit test framework based off Visual Studios or .NET?

Second: This question is derived from the issues we have with the unit tests. We have internal classes that need accessors in order to unit test them. When the application was in VS2005, all the accessors were auto created from right clicking on the desired class and selecting "Create Private Accessors" - this Accessor was placed in VSCodeGenAccessors.cs. Now after the migration to VS2008 and .net 3.5, the accessors are placed within a newly created folder "Test References" and for each accessor a file is created ( .accessor)

How, for consistency sake, do I get the accessors to be generated into VSCodeGenAccessors.cs.

Thanks!


回答1:


To answer your first question, the unit test framework is a part of certain versions of Visual Studio. AFAIR:

  • Visual Studio 2005 Team System
  • Visual Studio 2008 Team System
  • Visual Studio 2008 Professional

Regarding your second question I'm afraid I can't be of much help - I consider it a worst practice to unit tests internals, so I have no experience with the Private Accessors.



来源:https://stackoverflow.com/questions/1469632/unit-test-with-accessors

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!