[tests] Upgrade tests/linker to NUnit v4 Assert.That syntax#25484
Conversation
Convert classic NUnit assertions (Assert.AreEqual, Assert.IsNotNull, Assert.IsTrue, etc.) to NUnit v4 constraint-based Assert.That syntax across all linker test files. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR updates the linker test suite to use NUnit v4’s constraint-based Assert.That syntax, aligning the tests with the newer NUnit assertion style used across the repo.
Changes:
- Converted classic NUnit assertions (
Assert.True/False/Null/NotNull/AreEqual/IsTrue/...) toAssert.That(..., Is/Does/Has...)across linker tests. - Updated a few
Assert.Failcalls from composite formatting to interpolated strings while doing the conversion.
Reviewed changes
Copilot reviewed 30 out of 30 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/linker/link sdk/TaskTest.cs | Convert task continuation assertions to Assert.That. |
| tests/linker/link sdk/ReflectionTest.cs | Update commented assertion to Assert.That syntax. |
| tests/linker/link sdk/PclTest.cs | Convert classic assertions in PCL-related HTTP tests to constraints. |
| tests/linker/link sdk/OptimizeGeneratedCodeTest.cs | Convert null/boolean assertions to constraints. |
| tests/linker/link sdk/LocaleTest.cs | Convert Assert.True checks to Assert.That(..., Is.True). |
| tests/linker/link sdk/LinkSdkTest.cs | Convert type-presence assertions to constraint-based null checks. |
| tests/linker/link sdk/LinkSdkRegressionTest.cs | Broad conversion to Assert.That and a few Assert.Fail message updates. |
| tests/linker/link sdk/LinkExtraDefsTest.cs | Convert type/method presence checks to Assert.That. |
| tests/linker/link sdk/HttpClientHandlerTest.cs | Convert handler property assertions to constraints. |
| tests/linker/link sdk/DllImportTest.cs | Convert P/Invoke return + wait assertions to constraints. |
| tests/linker/link sdk/CryptoTest.cs | Convert crypto/network assertions to constraint-based syntax. |
| tests/linker/link sdk/BitcodeTest.cs | Convert equality/boolean assertions and update Assert.Fail formatting. |
| tests/linker/link sdk/AotBugs.cs | Convert LINQ/AOT regression assertions to constraints. |
| tests/linker/link all/StructLayoutTest.cs | Convert layout boolean assertions to constraints. |
| tests/linker/link all/SerializationTest.cs | Convert null/type preservation assertions to constraints. |
| tests/linker/link all/SealerTest.cs | Convert sealing/virtual/final assertions to constraints. |
| tests/linker/link all/PreserveTest.cs | Convert preservation checks to constraint assertions. |
| tests/linker/link all/LinqExpressionTest.cs | Convert lambda creation assertion to Assert.That. |
| tests/linker/link all/LinkAllTest.cs | Convert a large set of linker-behavior assertions to constraints. |
| tests/linker/link all/LinkAllMacTest.cs | Convert UI-thread/serialization assertions to constraints. |
| tests/linker/link all/InternalsTest.cs | Convert internal symbol assertions to constraints. |
| tests/linker/link all/InterfacesTest.cs | Convert reflection-based interface/linker assertions to constraints. |
| tests/linker/link all/DataContractTest.cs | Convert equality assertion to Assert.That. |
| tests/linker/link all/ClassLayoutTest.cs | Convert layout boolean assertions to constraints. |
| tests/linker/link all/AttributeTest.cs | Convert attribute-presence assertions to constraints. |
| tests/linker/dont link/DontLinkRegressionTests.cs | Convert assertions and update one Assert.Fail formatting string. |
| tests/linker/CommonLinkAnyTest.cs | Convert common linker assertions to Assert.That. |
| tests/linker/CommonLinkAllTest.cs | Convert type converter/version assertions to constraints. |
| tests/linker/BaseOptimizeGeneratedCodeTest.cs | Convert counter/IL-count/value assertions to constraints. |
| tests/linker/AppDelegate.cs | Convert test assembly count assertion to Assert.That. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ [PR Build #0704825] Build passed (Detect API changes) ✅Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ [PR Build #0704825] Build passed (Build packages) ✅Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ API diff for current PR / commitNET (empty diffs)✅ API diff vs stableNET (empty diffs)ℹ️ Generator diffGenerator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes) Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ [PR Build #0704825] Build passed (Build macOS tests) ✅Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
🔥 [CI Build #0704825] Test results 🔥Test results❌ Tests failed on VSTS: test results 1 tests crashed, 13 tests failed, 150 tests passed. Failures❌ fsharp tests2 tests failed, 2 tests passed.Failed tests
Html Report (VSDrops) Download ❌ linker tests (iOS)11 tests failed, 0 tests passed.Failed tests
Html Report (VSDrops) Download ❌ monotouch tests (MacCatalyst)🔥 Failed catastrophically on VSTS: test results - monotouch_maccatalyst (no summary found). Html Report (VSDrops) Download Successes✅ cecil: All 1 tests passed. Html Report (VSDrops) Download macOS tests✅ Tests on macOS Monterey (12): All 5 tests passed. Html Report (VSDrops) Download Linux Build VerificationPipeline on Agent |
🔥 Failed to compute test summaries on VSTS: test results 🔥Failed to compute test summaries: . |
Convert classic NUnit assertions (Assert.AreEqual, Assert.IsNotNull,
Assert.IsTrue, etc.) to NUnit v4 constraint-based Assert.That syntax
across all linker test files.