Csdn dotnet blog 专家群 冰戈
我在做使用 Visual Studio 2005 Team System 进行单元测试并生成用于 Unit Test Framework 的源代码时无意中发现的,觉得不应该是我Visual Studio 2005的问题,不知大家有没有!
按照文中说的一步一步来,得出两个工程,其中包括一个BankAccountTest.cs,在这个类中有段会出现这么个玩意
#region
Additional test attributes
//
// You can use the following additional attributes as you write your tests:
//
// Use ClassInitialize to run code before running the first test in the class
//
// [ClassInitialize()]
// public static void MyClassInitialize(TestContext testContext)
// {
// }
//
// Use ClassCleanup to run code after all tests in a class have run
//
// [ClassCleanup()]
// public static void MyClassCleanup()
// {
// }
//
// Use TestInitialize to run code before running each test
//
// [TestInitialize()]
// public void MyTestInitialize()
// {
// }
//
// Use TestCleanup to run code after each test has run
//
// [TestCleanup()]
// public void MyTestCleanup()
// {
// }
//
#endregion
把它折起来就这样了:
//
// You can use the following additional attributes as you write your tests:
//
// Use ClassInitialize to run code before running the first test in the class
//
// [ClassInitialize()]
// public static void MyClassInitialize(TestContext testContext)
// {
// }
//
// Use ClassCleanup to run code after all tests in a class have run
//
// [ClassCleanup()]
// public static void MyClassCleanup()
// {
// }
//
// Use TestInitialize to run code before running each test
//
// [TestInitialize()]
// public void MyTestInitialize()
// {
// }
//
// Use TestCleanup to run code after each test has run
//
// [TestCleanup()]
// public void MyTestCleanup()
// {
// }
//
#endregion

选中时又这样了(正常):

呵呵,估计是有这个问题,不知大家有没有,我的版本信息是
Microsoft Visual Studio 2005
Version 8.0.50727.26 (RTM.050727-2600)
Microsoft .NET Framework
Version 2.0.50727
大家试试,微软怕是不应该出这个毛病吧?
