Tuesday, November 3, 2009

NUnit 2.4.* to NUnit 2.5.* migration / Rhino.Mocks

NUnit 2.5 has changed quite substantially compared with the previous 2.4.8 release, as outlined in the NUnit 2.5 release notes
The problems that I had when migrating tests to NUnit 2.5 were:

  • Assert.IsInstanceOfType has been replaced by Assert.IsInstanceOf
  • NUnit.Framework.SyntaxHelpers namespace no longer exists. All classes that were in this namespace have been moved to the NUnit.Framework namespace
  • Many alias conflicts if using Rhino.Mocks
    using RIs = Rhino.Mocks.Constraints.Is;
    using NIs = NUnit.Framework.Is;
    using RProperty = Rhino.Mocks.Constraints.Property;
    using NProperty = NUnit.Framework.Property;
    using RAssert = NUnit.Framework.Assert;
    using NAssert = NUnit.Framework.Assert;
    using NList = NUnit.Framework.List;
    using RList = Rhino.Mocks.Constraints.List;
  • Has.Length(2); has been replaced by Has.Length.EqualTo(2));
  • Has.Count(1); has been replaced by Has.Count.EqualTo(1);
  • Has.Property("Length", 20) has been replaced by Has.Property("Length")
  • Error 243 Warning as Error: 'NUnit.Framework.Text' is obsolete: 'Use Is class for string constraints'
Good luck migrating