-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Description
Feature and motivation
With the release of NUnit 4.x, a few major breaking changes have been added. We want our test suite to be able to be prepared for NUnit 4, even if we're not going to upgrade for a while yet.
-
Classic Assert [dotnet] Migrate NUnit assertions to
Assert.Thatsyntax #14853 [dotnet] Migrate remaining NUnit assertions toAssert.ThatandHas.Count#14870
The "classic assert" model has been depreciated. In order to continue using them, the tests would need to jump through some hoops.A better solution would be to migrate to modern NUnit assertions. The
NUnit.Analyzersnuget package has useful features to accomplish this. Examples include:Assert.AreEqual("Testing Alerts", driver.Title)->Assert.That(driver.Title, Is.EqualTo("Testing Alerts"))Assert.AreEqual(1, allWindows.Count)->Assert.That(allWindows, Has.One.Items)
-
String format messages [dotnet] Correct assertion of struct type in internal tests #14878
NUnit 3.x has methods such asAssert.That(x, Is.EqualTo(y), "Value {0} is {1}", x, y). These overloads have been removed, in order to make room for caller argument expression parameters. We will have to go through and turn these all into interpolated strings. Same ForAssert.Ignore(string message, string[] args). -
The handful of uses of
StringAssertorCollectionAssertshould be changed toAssert.That. [dotnet] Migrate remaining NUnit assertions toAssert.ThatandHas.Count#14870