Skip to content

Update of ClassicAsserts documentation#1153

Open
OsirisTerje wants to merge 11 commits intomasterfrom
classicassertsupdate
Open

Update of ClassicAsserts documentation#1153
OsirisTerje wants to merge 11 commits intomasterfrom
classicassertsupdate

Conversation

@OsirisTerje
Copy link
Member

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.

Copilot AI review requested due to automatic review settings March 15, 2026 19:36
@OsirisTerje OsirisTerje requested review from SeanKilleen and Copilot and removed request for Copilot March 15, 2026 19:37
@OsirisTerje OsirisTerje changed the title Classicassertsupdate Update of ClassicAsserts documentation Mar 15, 2026
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

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 of ClassicAssert.*, and modernized one snippet to use collection expressions.
  • Split collection assertion examples into a new ClassicCollectionAssertExamples.cs snippet 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.

: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.
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.
OsirisTerje and others added 8 commits March 15, 2026 22:02
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants