We could automate the change using a regexp and do a massive replace, no? Using Notepad++ (http://notepad-plus.sourceforge.net/uk/regExpList.php), this seems to work fine:
Find: AssertEquals \((.+[^,]),(.+[^,]), (.+[^,])\); Replace with: Assert.AreEqual (\2, \3, \1); Needs a bit more work to remove the " : Assertion" part, but that's the idea. What do you think? Atsushi Eno-3 wrote: > > Hi, > > I'm thinking if we can upgrade our nunit tests to eliminate derivation > from Assertion (such as eliminating AssertEquals), to make our tests > ready for future versions of NUnit. > > The task is very easy: if there is a test class that looks like > > [TestFixture] > public class FooTest : Assertion > { > [Test] > public void FooBar () > { > AssertEquals ("#1", str1, str2); > } > } > > rewrite it like: > > [TestFixture] > public class FooTest > { > [Test] > public void FooBar () > { > Assert.AreEqual (str1, str2, "#1"); > } > } > > I tried to count it by "grep AssertEquals", and there were 8000 lines > in corlib, 1000 lines in System, 1500 lines in Sys.XML, and so on. > > So, it is a simple but massive task that I cannot do it by myself. > But if we can hack a volunteer team from here it would be possible. > > If you can join the effort, you are welcome :) > > * list of the files > > I have made an easy list of such "old" test files on a spreadsheet: > http://spreadsheets.google.com/pub?key=rkWl-ZQHJvcu6tkJOeFFg3A&output=html > > * workflow > > Basically, removing the base class (Assertion) will give lots of > errors. And when there is no more errors, then you are done with it. > > You might want to mark your ownership on the spreadsheet before > you actually start working on them. I'll release the ownership > if some of them are "locking". > > If you have commit access, let's just check in. Otherwise, post > your changes. (attachment, monoport, etc.) > > One sort of concern is that, if you are actively maintaining some code > files and making changes in such old test files, please mark them as > you don't want them changed. > We don't have to do this conversion task perfectly right now. (And > of course you don't have to do upgrade task by yourself because of > marking them.) > > * starting > > If you are willing to join the task force, please drop me a line > and/or post to the list (here) :) > > I'll share the spreadsheet so that you can edit the spreadsheet. > If you don't have Google account, I'll update it instead (with > possible delay). > > Atsushi Eno > _______________________________________________ > Mono-devel-list mailing list > Mono-devel-list@lists.ximian.com > http://lists.ximian.com/mailman/listinfo/mono-devel-list > > -- View this message in context: http://www.nabble.com/nunit-test-upgrading-task-force-tp24160673p24163520.html Sent from the Mono - Dev mailing list archive at Nabble.com. _______________________________________________ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list