Click here to Skip to main content
15,884,425 members
Articles / Programming Languages / C#

How to quickly debug a NUnit test in Visual Studio

Rate me:
Please Sign up or sign in to vote.
4.67/5 (6 votes)
30 Sep 2009CPOL5 min read 46.1K   445   21  
An article on quickly debugging NUnit tests.
//-------------------------------------------------------------------------------------
// <copyright file='AssemblyHelper.cs' company='Jonno'>
//     Copyright (c) Paul Johnson 2009 (email:paulmichael.johnson@gmail.com)
//     Code is released under The Code Project Open License (CPOL).
// </copyright>
//-------------------------------------------------------------------------------------

namespace Jonno.Utilities
{
    using System.Reflection;
    using Jonno.Extensions;

    /// <summary>
    /// Functions that help with Assembly manipulation.     
    /// </summary>
    public static class AssemblyHelper
    {
        /// <summary>
        /// Gets the folder the assembly is executing in.
        /// </summary>
        /// <param name="assembly">The assembly to convert the path for.</param>
        /// <returns>The folder.</returns>
        public static string GetAssemblyFolderName(Assembly assembly)
        {
            var folder = assembly.Location;
            if (folder == null)
            {
                return string.Empty;
            }
            
            var lastSlash = folder.LastIndexOf(System.IO.Path.DirectorySeparatorChar) + 1;
            return folder.Left(lastSlash);            
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
United Kingdom United Kingdom
I have over 15 years of development experience, in many different languages, programming styles and platforms. Currently working as a C# coder, and residing in north Herts in the UK. I love lean software development and anything that reduces a grind to leave more time for useful coding!

Comments and Discussions