diff options
author | Atsushi Eno <atsushieno@veritas-vos-liberabit.com> | 2013-01-22 12:23:48 +0400 |
---|---|---|
committer | Atsushi Eno <atsushieno@veritas-vos-liberabit.com> | 2013-01-22 12:23:48 +0400 |
commit | 8911e1d3f169a0e378b4e237926269d9218c8fd3 (patch) | |
tree | a289bfd5226af1cbee01b55fa8c1eec4c4ab204c /replacer.sh | |
parent | 8f45b386f24fd824a7db294e3e6b805ac260fef2 (diff) |
prepare for new directory structure introduced at 2b5dbddd740b in original rx.
Diffstat (limited to 'replacer.sh')
-rw-r--r-- | replacer.sh | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/replacer.sh b/replacer.sh new file mode 100644 index 0000000..bcc15c1 --- /dev/null +++ b/replacer.sh @@ -0,0 +1,24 @@ +using System.IO; +using System.Text; + +foreach (var file in Directory.GetFiles (".", "*.cs", SearchOption.AllDirectories)) { + var text = File.ReadAllText (file); + if (text.Contains ("#if NUNIT")) + continue; + Console.Error.WriteLine (file + " : " + text.Contains ("using Microsoft.VisualStudio.TestTools.UnitTesting;")); + text = text.Replace ( +"using Microsoft.VisualStudio.TestTools.UnitTesting;", +@"#if NUNIT +using NUnit.Framework; +using TestClassAttribute = NUnit.Framework.TestFixtureAttribute; +using TestMethodAttribute = NUnit.Framework.TestAttribute; +using TestInitializeAttribute = NUnit.Framework.SetUpAttribute; +#else +using Microsoft.VisualStudio.TestTools.UnitTesting; +#endif".Replace ("\n", "\r\n")); + + text = text.Replace ("[Timeout", "//[Timeout"); // no TimeoutAttribute in NUnit. + + using (var tw = new StreamWriter (file, false, new UTF8Encoding (true, true))) + tw.Write (text); +} |