Skip to content

Instantly share code, notes, and snippets.

@morkeleb
Created September 12, 2011 07:54
Show Gist options
  • Save morkeleb/1210784 to your computer and use it in GitHub Desktop.
Save morkeleb/1210784 to your computer and use it in GitHub Desktop.
Switch from MSTest to NUnit bash script
find . -type f -print1 | xargs -0 sed -i '' 's/\[TestMethod\]/\[Test\]/g'
find . -type f -print0 | xargs -0 sed -i '' 's/\[TestMethod()\]/\[Test\]/g'
find . -type f -print0 | xargs -0 sed -i '' 's/\[TestClass\]/\[TestFixture\]/g'
find . -type f -print0 | xargs -0 sed -i '' 's/\[TestClass()\]/\[TestFixture\]/g'
find . -type f -print0 | xargs -0 sed -i '' 's/\[TestInitialize\]/\[SetUp\]/g'
find . -type f -print0 | xargs -0 sed -i '' 's/\[TestInitialize()\]/\[SetUp\]/g'
find . -type f -print0 | xargs -0 sed -i '' 's/\[TestCleanup\]/\[TearDown\]/g'
find . -type f -print0 | xargs -0 sed -i '' 's/\[TestCleanup()\]/\[TearDown\]/g'
find . -type f -print0 | xargs -0 sed -i '' 's/\[ClassInitialize\]/\[TestFixtureSetUp\]/g'
find . -type f -print0 | xargs -0 sed -i '' 's/\[ClassInitialize()\]/\[TestFixtureSetUp\]/g'
find . -type f -print0 | xargs -0 sed -i '' 's/\[ClassCleanup\]/\[TestFixtureTearDown\]/g'
find . -type f -print0 | xargs -0 sed -i '' 's/\[ClassCleanup()\]/\[TestFixtureTearDown\]/g'
find . -type f -print0 | xargs -0 sed -i '' 's/using Microsoft.VisualStudio.TestTools.UnitTesting/using NUnit.Framework/g'
find . -type f -print0 | xargs -0 sed -i '' 's/using Rhino.Mocks.Contraints/using Is \= Rhino.Mocks.Constraints.Is/g'
find . -type f -print0 | xargs -0 sed -i '' 's/<Reference Include=\"Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL\" \/>/<Reference Include=\"nunit.framework, Version=2.5.10.11092, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL\" \/>/g'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment