Login or Sign Up to become a member!
LessThanDot Sit Logo

LessThanDot

Desktop Developer

Less Than Dot is a community of passionate IT professionals and enthusiasts dedicated to sharing technical knowledge, experience, and assistance. Inside you will find reference materials, interesting technical discussions, and expert tips and commentary. Once you register for an account you will have immediate access to the forums and all past articles and commentaries.

LTD Social Sitings

Lessthandot twitter Lessthandot Linkedin Lessthandot friendfeed Lessthandot facebook Lessthandot rss

Note: Watch for social icons on posts by your favorite authors to follow their postings on these and other social sites.

Your profile

    Search

    XML Feeds

    Google Ads

    « Finding a bug I read about but forgotGetting the UnderLyingType of a Generic Object in VB.Net »
    comments

    Like the title says An nUnit testfixture file template for resharper that also conforms to stylecop laws. Here it is.

    1. // --------------------------------------------------------------------------------------------------------------------
    2. // <copyright file="$FileName$" company="$Company$">
    3. //   $Author$
    4. // </copyright>
    5. // <summary>
    6. //   Tests the $FIXTURE$ type.
    7. // </summary>
    8. // --------------------------------------------------------------------------------------------------------------------
    9.  
    10. namespace $NAMESPACE$
    11. {
    12.     using NUnit.Framework;
    13.  
    14.     /// <summary>
    15.     /// Test for $FIXTURE$
    16.     /// </summary>
    17.     [TestFixture]
    18.     public class Test$FIXTURE$
    19.     {
    20.         /// <summary>
    21.         /// Test $TestName$
    22.         /// </summary>
    23.         [Test]
    24.         public void $TestName$()
    25.         {
    26.         }
    27.     }
    28. }

    That's the way I like them and no more stylecop warnings. Since Stylecop doesn't exist in VB.Net I don't have the equivalent.

    This is the xml. Just copy paste this in a file and then import it in resharper file templates.

    1. <TemplatesExport family="File Templates">
    2.   <Template uid="3a8692a1-37f3-4d44-9310-639548a1d876" shortcut="" description="NUnit Test Fixture" text="// --------------------------------------------------------------------------------------------------------------------&#xD;&#xA;// <copyright file=&quot;$FileName$&quot; company=&quot;$Company$&quot;>&#xD;&#xA;//   $Author$&#xD;&#xA;// </copyright>&#xD;&#xA;// <summary>&#xD;&#xA;//   Tests the $FIXTURE$ type.&#xD;&#xA;// </summary>&#xD;&#xA;// --------------------------------------------------------------------------------------------------------------------&#xD;&#xA;&#xD;&#xA;namespace $NAMESPACE$&#xD;&#xA;{&#xD;&#xA;    using NUnit.Framework;&#xD;&#xA;&#xD;&#xA;    /// <summary>&#xD;&#xA;    /// Test for $FIXTURE$&#xD;&#xA;    /// </summary>&#xD;&#xA;    [TestFixture]&#xD;&#xA;    public class Test$FIXTURE$&#xD;&#xA;    {&#xD;&#xA;        /// <summary>&#xD;&#xA;        /// Test $TestName$&#xD;&#xA;        /// </summary>&#xD;&#xA;        [Test]&#xD;&#xA;        public void $TestName$()&#xD;&#xA;        {&#xD;&#xA;        }&#xD;&#xA;    }&#xD;&#xA;}" reformat="True" shortenQualifiedReferences="True">
    3.     <Context>
    4.       <ProjectLanguageContext language="CSharp" />
    5.     </Context>
    6.     <Categories />
    7.     <Variables>
    8.       <Variable name="NAMESPACE" expression="fileDefaultNamespace()" initialRange="-1" />
    9.       <Variable name="FileName" expression="getFileName()" initialRange="0" />
    10.       <Variable name="Company" expression="constant(&quot;NICC&quot;)" initialRange="0" />
    11.       <Variable name="FIXTURE" expression="getFileNameWithoutExtension()" initialRange="-1" />
    12.       <Variable name="Author" expression="getFullUserName()" initialRange="0" />
    13.       <Variable name="TestName" expression="" initialRange="0" />
    14.     </Variables>
    15.     <CustomProperties>
    16.       <Property key="FileName" value="Test" />
    17.       <Property key="Extension" value="cs" />
    18.       <Property key="ValidateFileName" value="False" />
    19.     </CustomProperties>
    20.   </Template>
    21. </TemplatesExport>

    About the Author

    User bio imageChristiaan is a forensic technician who programs on the side, although my function description says that I do IT-things for 90% of the time . I'm an avid VB.NET fan and I use lots of the ALT.Net techniques, like unit-testing, nhibernate, logging, IoC, ...
    Social SitingsTwitterLinkedInHomePageLTD RSS Feed
    c#, nunit, resharper
    Instapaper

    No feedback yet

    Leave a comment


    Your email address will not be revealed on this site.

    Your URL will be displayed.
    (Line breaks become <br />)
    (Name, email & website)
    (Allow users to contact you through a message form (your email will not be revealed.)