Visual studio 建立文件时自动添加备注

Visual studio 建立文件时自动添加备注单元测试

描述测试

要求每回添加一个类,普通类或单元测试类文件头自动添加备注, 好比:Copyright, FileName, Author and so on.spa

 

普通类文件code

操做步骤:blog

1. 找出Class.cs, 存放位置:C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\ItemTemplates\CSharp\Code\1033\Class。get

2. 编辑Class.cs文件, 添加上文件备注(绿色部分)。it

/*===============================================================================================

 Copyright© $year$ xxx Ltd. All rights reserved.
 
 File     : $safeitemname$.cs
 Author   : xxx xxx
 Created  : $time$ 
 Summary  : 

 ===============================================================================================*/
using System;
using System.Collections.Generic;
$if$ ($targetframeworkversion$ >= 3.5)using System.Linq;
$endif$using System.Text;
$if$ ($targetframeworkversion$ >= 4.5)using System.Threading.Tasks;
$endif$
namespace $rootnamespace$
{
    class $safeitemrootname$
    {
    }
}


 单元测试类文件(此处用的是NUnit测试类)io

  操做步骤:class

 1. 找到 UnitTest.cs, 存放位置:C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\ItemTemplates\CSharp\Test\1033\BasicUnitTestim

 2. 编辑UnitTest.cs文件, 添加上文件备注(绿色部分), [TestFixture] and [Test]。

/*===============================================================================================

 Copyright© $year$ xxx Ltd. All rights reserved.
 
 File     : $safeitemname$.cs
 Author   : xxx xxx
 Created  : $time$ 
 Summary  : 

 ===============================================================================================*/

using System;
using NUnit.Framework;

namespace $rootnamespace$
{
    [TestFixture]
    public class $safeitemname$
    {
        [Test]
        public void TestMethod1()
        {
        }
    }
}
相关文章
相关标签/搜索