Last active
December 28, 2015 03:49
-
-
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 file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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