Skip to content

[tests] Migrate Cecil tests to NUnit v4.#24525

Merged
rolfbjarne merged 2 commits intomainfrom
dev/rolf/tests-migrate-cecil-tests-to-nunit-4
Jan 20, 2026
Merged

[tests] Migrate Cecil tests to NUnit v4.#24525
rolfbjarne merged 2 commits intomainfrom
dev/rolf/tests-migrate-cecil-tests-to-nunit-4

Conversation

@rolfbjarne
Copy link
Member

No description provided.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates the Cecil test suite from NUnit v3 to NUnit v4, updating package references and converting assertion syntax to be compatible with the newer version.

Changes:

  • Updated NUnit and related test package versions in Directory.Build.props
  • Replaced hardcoded package versions with centralized version variables in cecil-tests.csproj
  • Converted legacy NUnit assertion syntax to constraint model (e.g., Assert.FalseAssert.That(..., Is.False))

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
Directory.Build.props Defines centralized version variables for NUnit v4 packages and test SDK
tests/cecil-tests/cecil-tests.csproj Replaces hardcoded package versions with centralized variables
tests/cecil-tests/Test.cs Updates assertion syntax from legacy to constraint model
tests/cecil-tests/Helper.cs Updates assertion syntax and adds null-coalescing operator for null safety
tests/cecil-tests/GetterExceptionTest.cs Converts Assert.AreEqual to constraint model
tests/cecil-tests/GenericPInvokes.cs Converts assertions to constraint model
tests/cecil-tests/BlittablePInvokes.cs Converts Assert.IsNotNull to constraint model
tests/cecil-tests/ApiCapitalizationTest.cs Converts Assert.AreEqual to constraint model
tests/cecil-tests/ApiAvailabilityTest.cs Converts Assert.AreEqual to constraint model

var assembly = info.Assembly;
var pinvokes = AllPInvokes (assembly).Where (IsPInvokeOK);
Assert.IsTrue (pinvokes.Count () > 0);
Assert.That (pinvokes.Count, Is.GreaterThan (0), Is.True);
Copy link

Copilot AI Jan 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The third argument Is.True appears to be incorrectly used. The constraint Is.GreaterThan(0) already expresses the assertion; adding Is.True is unnecessary and likely invalid syntax. Remove the Is.True parameter.

Suggested change
Assert.That (pinvokes.Count, Is.GreaterThan (0), Is.True);
Assert.That (pinvokes.Count, Is.GreaterThan (0));

Copilot uses AI. Check for mistakes.
var assembly = info.Assembly;
var pinvokes = AllPInvokes (assembly).Where (IsPInvokeOK);
Assert.IsTrue (pinvokes.Count () > 0);
Assert.That (pinvokes.Count, Is.GreaterThan (0), Is.True);
Copy link

Copilot AI Jan 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using Count property instead of Count() method would be more appropriate if pinvokes is an ICollection or IList. If it's an IEnumerable, the call is correct, but the type should be clarified for consistency with line 38-39.

Suggested change
Assert.That (pinvokes.Count, Is.GreaterThan (0), Is.True);
Assert.That (pinvokes.Count (), Is.GreaterThan (0), Is.True);

Copilot uses AI. Check for mistakes.
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@rolfbjarne rolfbjarne enabled auto-merge (squash) January 19, 2026 17:22
@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [PR Build #d66dfd3] Build passed (Detect API changes) ✅

Pipeline on Agent
Hash: d66dfd3a692a5b6f02a60c39698f87a767399a1a [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [CI Build #d66dfd3] Build passed (Build packages) ✅

Pipeline on Agent
Hash: d66dfd3a692a5b6f02a60c39698f87a767399a1a [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ API diff for current PR / commit

NET (empty diffs)

✅ API diff vs stable

NET (empty diffs)

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: d66dfd3a692a5b6f02a60c39698f87a767399a1a [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [CI Build #d66dfd3] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: d66dfd3a692a5b6f02a60c39698f87a767399a1a [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #d66dfd3] Tests on macOS X64 - Mac Sonoma (14) passed 💻

All tests on macOS X64 - Mac Sonoma (14) passed.

Pipeline on Agent
Hash: d66dfd3a692a5b6f02a60c39698f87a767399a1a [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #d66dfd3] Tests on macOS M1 - Mac Monterey (12) passed 💻

All tests on macOS M1 - Mac Monterey (12) passed.

Pipeline on Agent
Hash: d66dfd3a692a5b6f02a60c39698f87a767399a1a [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #d66dfd3] Tests on macOS M1 - Mac Ventura (13) passed 💻

All tests on macOS M1 - Mac Ventura (13) passed.

Pipeline on Agent
Hash: d66dfd3a692a5b6f02a60c39698f87a767399a1a [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #d66dfd3] Tests on macOS arm64 - Mac Sequoia (15) passed 💻

All tests on macOS arm64 - Mac Sequoia (15) passed.

Pipeline on Agent
Hash: d66dfd3a692a5b6f02a60c39698f87a767399a1a [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #d66dfd3] Tests on macOS arm64 - Mac Tahoe (26) passed 💻

All tests on macOS arm64 - Mac Tahoe (26) passed.

Pipeline on Agent
Hash: d66dfd3a692a5b6f02a60c39698f87a767399a1a [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

🚀 [CI Build #d66dfd3] Test results 🚀

Test results

✅ All tests passed on VSTS: test results.

🎉 All 125 tests passed 🎉

Tests counts

✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (iOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (MacCatalyst): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (macOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (Multiple platforms): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (tvOS): All 1 tests passed. Html Report (VSDrops) Download
✅ framework: All 2 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 4 tests passed. Html Report (VSDrops) Download
✅ generator: All 5 tests passed. Html Report (VSDrops) Download
✅ interdependent-binding-projects: All 4 tests passed. Html Report (VSDrops) Download
✅ introspection: All 4 tests passed. Html Report (VSDrops) Download
✅ linker: All 44 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 11 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 15 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ monotouch (macOS): All 9 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 11 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ windows: All 3 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 4 tests passed. Html Report (VSDrops) Download
✅ xtro: All 1 tests passed. Html Report (VSDrops) Download

Pipeline on Agent
Hash: d66dfd3a692a5b6f02a60c39698f87a767399a1a [PR build]

@rolfbjarne rolfbjarne merged commit 1d5c873 into main Jan 20, 2026
45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants