Skip to content

Instantly share code, notes, and snippets.

@OsirisTerje
Last active December 28, 2015 03:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save OsirisTerje/7437743 to your computer and use it in GitHub Desktop.
Save OsirisTerje/7437743 to your computer and use it in GitHub Desktop.
NUnit MS Test Conversion methods. Add this code to keep MSTest code close to unchanged when replacing it with NUnit. If you use the IsInstanceOfType, you should add the following line at the top of your MSTest file: using Assert = NUnit.Framework.AssertMs;
// This code is grabbed off https://gist.github.com/OsirisTerje/7437743
using System;
namespace NUnit.Framework
{
public class TestClassAttribute : TestFixtureAttribute
{ }
public class TestMethodAttribute: TestAttribute
{ }
public class TestInitializeAttribute : SetUpAttribute
{ }
public class TestCleanupAttribute : TearDownAttribute
{ }
/// <summary>
/// Add using Assert = NUnit.Framework.AssertMs;
/// at top of file to avoid using AssertMs in front of these.
/// You might need to suppress a R# warning, add it to your team settings.
/// </summary>
public class AssertMs : Assert
{
public static void IsInstanceOfType(object actual, Type expected)
{
Assert.IsInstanceOf(expected,actual);
}
}
public class TestCategory : CategoryAttribute
{
public TestCategory(string category) : base(category)
{
}
}
public class TestPropertyAttribute : PropertyAttribute
{
public TestPropertyAttribute(string prop, string value) : base(prop,value)
{
}
}
public class PriorityAttribute : PropertyAttribute
{
public PriorityAttribute(int n) : base("Priority",n)
{
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment