Created
May 25, 2017 12:42
-
-
Save GeorgDangl/7e3b786f2973b72bbae17974e7d33c54 to your computer and use it in GitHub Desktop.
Migrating MSTest to xUnit
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
Param( | |
[string ]$ProjectDir | |
) | |
get-childitem $ProjectDir -recurse -include *.cs | | |
select -expand fullname | | |
foreach { | |
( Get-Content $_ ) -replace '\[TestMethod\]','[Fact]' ` | |
-replace 'Assert.AreEqual' , 'Assert.Equal' ` | |
-replace 'Assert.AreNotEqual' , 'Assert.NotEqual' ` | |
-replace 'Assert.IsTrue' , 'Assert.True' ` | |
-replace 'Assert.IsFalse' , 'Assert.False' ` | |
-replace 'Assert.IsNotNull' , 'Assert.NotNull' ` | |
-replace 'Assert.IsNull' , 'Assert.Null' ` | |
-replace '\[TestClass\]' , ' ' ` | |
-replace 'Assert.AreNotSame' , 'Assert.NotSame' ` | |
-replace 'Assert.AreSame' , 'Assert.Same' ` | |
-replace 'Assert.IsInstanceOfType' , 'Assert.IsType' ` | |
-replace 'Assert.IsNotInstanceOfType' , 'Assert.IsNotType' ` | |
-replace 'using Microsoft.VisualStudio.TestTools.UnitTesting' , 'using Xunit' ` | |
| Set-Content -Encoding utf8 $_ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment