This is a cheat sheet I prepared when testing migrations between MBUnit and NUnit. It only covers the areas we used so it's far from complete. It should give a good head start though.
| MBUnit | NUnit |
|---|---|
| [FixtureSetUp] | [OneTimeSetUp] |
| [Row] | [TestCase] |
| [Factory] | [TestCaseSource] for test cases, [ValueSource] for individual parameters |
| [Column] | [Values] |
| [SequentialJoin] | [Sequential] |
| [CombinatorialJoin] | [Combinatorial] |
| Assert.IsInstanceOfType<T>(y) | Assert.IsInstanceOf<T>(y) |
| Assert.AreElementsEqual(coll, expectedColl) | CollectionAssert.AreEqual(expectedColl, coll) |
| Assert.AreElementsEqualIgnoringOrder(coll, expectedColl) | CollectionAssert.AreEquivalent(expectedColl, coll) |
| Assert.AreElementsSame(expectedColl, coll) | CollectionAssert.AreEqual(expectedColl, coll) ??? |
| Assert.AreEqual(coll, expectedColl) | CollectionAssert.AreEqual(expectedColl, coll) |
| Assert.Contains(coll,item) | CollectionAssert.Contains(coll, item) |
| Assert.DoesNotContain(coll,item) | CollectionAssert.DoesNotContain(coll, item) |
| Assert.IsEmpty(coll) | CollectionAssert.IsEmpty(coll) |
| Assert.IsEmpty(str) | Assert.That(str, Is.Empty) |
| Assert.StartsWith(str, substr) | StringAssert.StartsWith(substr, str) |
| Assert.EndsWith(str, substr) | StringAssert.EndsWith(substr, str) |
| Assert.Contains(str, substr) | StringAssert.Contains(substr, str) |
| Assert.DoesNotContain(str, substr) | StringAssert.DoesNotContain(substr, str) |
| Assert.AreEqual(expected, result, new StructuralEqualityComparer) | Assert.That(result, Is.EqualTo(expected).Using(new Comparer()) |
| Assert.LessThanOrEqualTo(x,y) | Assert.LessOrEqual(x, y) |
| Assert.LessThan(x,y) | Assert.Less(x, y) |
| Assert.GreaterThan(x,y) | Assert.Greater(x, y) |
| Assert.GreaterThanOrEqualTo(x,y) | Assert.GreaterOrEqual(x, y) |
| Assert.ForAll(coll, item => code) | Assert.IsFalse(coll.Any(item => !code)) |
| Assert.Between(modifiedDate, new DateTime(2014, 01, 01), new DateTime(2999, 01, 01)) | Assert.That(modifiedDate, Is.InRange(new DateTime(2014, 01, 01), new DateTime(2999, 01, 01))) |
| Assert.AreApproximatelyEqual(expectedDate, actualDate, TimeSpan.FromSeconds(5)) | Assert.That(actualDate, Is.EqualTo(expectedDate).Within(5).Seconds); |