Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates NUnit documentation snippets and classic-assertion docs to reflect NUnit 4.5.0’s classic-assert extension methods, favoring Assert.* (with using NUnit.Framework) over ClassicAssert for many classic assertions.
Changes:
- Updated snippets to use
Assert.*in place ofClassicAssert.*, and modernized one snippet to use collection expressions. - Split collection assertion examples into a new
ClassicCollectionAssertExamples.cssnippet file. - Updated classic assertion documentation pages (titles + signatures) and added a new “classic extensions” mapping document; updated the classic model page accordingly.
Reviewed changes
Copilot reviewed 29 out of 29 changed files in this pull request and generated 31 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/snippets/Snippets.NUnit/ClassicVsConstraintAssertions.cs | Removes legacy import and updates examples to use Assert.* and modern array syntax. |
| docs/snippets/Snippets.NUnit/ClassicCollectionAssertExamples.cs | New snippet file containing CollectionAssert examples in NUnit.Framework.Legacy. |
| docs/snippets/Snippets.NUnit/ClassicAssertExamples.cs | Replaces ClassicAssert.* usage with Assert.* extension method syntax. |
| docs/articles/nunit/writing-tests/assertions/classic-assertions/Assert.Zero.md | Renames to Assert.Zero and updates signatures + adds version note. |
| docs/articles/nunit/writing-tests/assertions/classic-assertions/Assert.True.md | Renames to Assert.True and updates signatures + adds version note. |
| docs/articles/nunit/writing-tests/assertions/classic-assertions/Assert.Positive.md | Renames to Assert.Positive and updates examples/signatures + adds version note. |
| docs/articles/nunit/writing-tests/assertions/classic-assertions/Assert.Null.md | Renames to Assert.Null and updates signatures + adds version note. |
| docs/articles/nunit/writing-tests/assertions/classic-assertions/Assert.NotZero.md | Renames to Assert.NotZero and updates signatures + adds version note. |
| docs/articles/nunit/writing-tests/assertions/classic-assertions/Assert.NotNull.md | Renames to Assert.NotNull and updates signatures + adds version note. |
| docs/articles/nunit/writing-tests/assertions/classic-assertions/Assert.Negative.md | Renames to Assert.Negative and updates examples/signatures + adds version note. |
| docs/articles/nunit/writing-tests/assertions/classic-assertions/Assert.LessOrEqual.md | Renames to Assert.LessOrEqual and updates signatures + adds version note. |
| docs/articles/nunit/writing-tests/assertions/classic-assertions/Assert.Less.md | Renames to Assert.Less and updates signatures + adds version note. |
| docs/articles/nunit/writing-tests/assertions/classic-assertions/Assert.IsNotInstanceOf.md | Renames to Assert.IsNotInstanceOf and updates signatures + adds version note. |
| docs/articles/nunit/writing-tests/assertions/classic-assertions/Assert.IsNotEmpty.md | Renames to Assert.IsNotEmpty and updates signatures + adds version note. |
| docs/articles/nunit/writing-tests/assertions/classic-assertions/Assert.IsNotAssignableFrom.md | Renames to Assert.IsNotAssignableFrom and updates signatures + adds version note. |
| docs/articles/nunit/writing-tests/assertions/classic-assertions/Assert.IsNaN.md | Renames to Assert.IsNaN and updates signatures + adds version note. |
| docs/articles/nunit/writing-tests/assertions/classic-assertions/Assert.IsInstanceOf.md | Renames to Assert.IsInstanceOf and updates signatures + adds version note. |
| docs/articles/nunit/writing-tests/assertions/classic-assertions/Assert.IsEmpty.md | Renames to Assert.IsEmpty and updates signatures + adds version note. |
| docs/articles/nunit/writing-tests/assertions/classic-assertions/Assert.IsAssignableFrom.md | Renames to Assert.IsAssignableFrom and updates signatures + adds version note. |
| docs/articles/nunit/writing-tests/assertions/classic-assertions/Assert.GreaterOrEqual.md | Renames to Assert.GreaterOrEqual and updates signatures + adds version note. |
| docs/articles/nunit/writing-tests/assertions/classic-assertions/Assert.Greater.md | Renames to Assert.Greater and updates signatures + adds version note. |
| docs/articles/nunit/writing-tests/assertions/classic-assertions/Assert.False.md | Renames to Assert.False and updates signatures + adds version note. |
| docs/articles/nunit/writing-tests/assertions/classic-assertions/Assert.Contains.md | Renames to Assert.Contains and updates signatures + adds version note. |
| docs/articles/nunit/writing-tests/assertions/classic-assertions/Assert.AreSame.md | Renames to Assert.AreSame and updates signatures + adds version note. |
| docs/articles/nunit/writing-tests/assertions/classic-assertions/Assert.AreNotSame.md | Renames to Assert.AreNotSame and updates signatures + adds version note. |
| docs/articles/nunit/writing-tests/assertions/classic-assertions/Assert.AreNotEqual.md | Renames to Assert.AreNotEqual and updates signatures + adds version note. |
| docs/articles/nunit/writing-tests/assertions/classic-assertions/Assert.AreEqual.md | Renames to Assert.AreEqual and updates signatures + adds version note. |
| docs/articles/nunit/writing-tests/assertions/assertion-models/classic_extensions.md | New mapping doc describing classic-assert extension methods and usage. |
| docs/articles/nunit/writing-tests/assertions/assertion-models/classic.md | Updates classic model page to explain 4.5.0 extension methods and refreshes links. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
docs/articles/nunit/writing-tests/assertions/classic-assertions/Assert.Zero.md
Outdated
Show resolved
Hide resolved
docs/articles/nunit/writing-tests/assertions/assertion-models/classic.md
Outdated
Show resolved
Hide resolved
| :NOTE: The `ClassicAssert` and `NUnit.Framework.Legacy` are still available in 4.5.0, so you don't need to change code | ||
| that already use this. | ||
|
|
||
| :NOTE: See [classic extensions](../classic_extensions.md) for a full table over all extension mappings. |
docs/articles/nunit/writing-tests/assertions/classic-assertions/Assert.Positive.md
Outdated
Show resolved
Hide resolved
docs/articles/nunit/writing-tests/assertions/classic-assertions/Assert.IsEmpty.md
Outdated
Show resolved
Hide resolved
docs/articles/nunit/writing-tests/assertions/classic-assertions/Assert.IsNotAssignableFrom.md
Outdated
Show resolved
Hide resolved
Comment on lines
+5
to
+9
| :NOTE: From version 4.5.0, using C# 14, you don't need to use the ClassicAssert class, nor the NUnit.Framework.Legacy | ||
| namespace, but can use the former Assert class. This applies for many of the asserts, but a few still require the use of | ||
| the ClassicAssert class. These will be fixed in upcoming releases. In the list below, and in the examples, the 4.5.0 | ||
| syntax will be used. If you use an earlier 4.x version, replace Assert with ClassicAssert and include the | ||
| NUnit.Framework.Legacy namespace. |
Comment on lines
+5
to
+9
| :NOTE: From version 4.5.0, using C# 14, you don't need to use the ClassicAssert class, nor the NUnit.Framework.Legacy | ||
| namespace, but can use the former Assert class. This applies for many of the asserts, but a few still require the use of | ||
| the ClassicAssert class. These will be fixed in upcoming releases. In the list below, and in the examples, the 4.5.0 | ||
| syntax will be used. If you use an earlier 4.x version, replace Assert with ClassicAssert and include the | ||
| NUnit.Framework.Legacy namespace. |
Comment on lines
+7
to
+11
| :NOTE: From version 4.5.0, using C# 14, you don't need to use the ClassicAssert class, nor the NUnit.Framework.Legacy | ||
| namespace, but can use the former Assert class. This applies for many of the asserts, but a few still require the use of | ||
| the ClassicAssert class. These will be fixed in upcoming releases. In the list below, and in the examples, the 4.5.0 | ||
| syntax will be used. If you use an earlier 4.x version, replace Assert with ClassicAssert and include the | ||
| NUnit.Framework.Legacy namespace. |
docs/articles/nunit/writing-tests/assertions/classic-assertions/Assert.NotZero.md
Outdated
Show resolved
Hide resolved
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>
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>
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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Updated the classic asserts to reflect the changes in 4.5.0 wrt the new extension methods that allow you to use the Assert class and the NUnit.Framework namespace for these.