Visual Studio 2010 template for new UnitTest module

How can I create a unit test template like this? I am using visual studio 2010 and Resharper 5.

using NUnit.Framework;

namespace SolutionName.Core
{
    [TestFixture]
    public class ClassNameTests
    {
        [Test]
        public void test()
        {

        }
    }
} 
+3
source share
1 answer

Yes it is possible. This answer requires that Reshaper be installed .

First go to the menu and select Resharper => Live Templates. Click the File Templates tab. Add a new template.

Give the template a description of the type "UnitTest" Give it a default name, for example, "Test.cs", and select "The file name must be a valid identifier" Change the accessibility to "in the C # project ..."

. . $-ch. $END $, . :

using NUnit.Framework;

namespace SolutionName.Core
{
    [TestFixture]
    public class $ClassNameTests$
    {
        [Test]
        public void test()
        { 
            $END$
        }
    }
} 

( , ). ClassNameTests. " ". ,

, "" - " " → "...". . , " " . , Resharper .

Add → New From Template → Your Template Name

, . . , $-chars. , -.

+5

Source: https://habr.com/ru/post/1746495/


All Articles