Skip to content

Update Throws/Catch/DoesNotThrow async assertion documentation for NUnit 5#1183

Open
stevenaw wants to merge 4 commits into
nunit:masterfrom
stevenaw:1180-async-returns-task
Open

Update Throws/Catch/DoesNotThrow async assertion documentation for NUnit 5#1183
stevenaw wants to merge 4 commits into
nunit:masterfrom
stevenaw:1180-async-returns-task

Conversation

@stevenaw
Copy link
Copy Markdown
Member

Fixes #1180
Contributes to #1164

// Negative tests
Assert.That("Hello", Is.Not.InstanceOf<int>());
Assert.That(null, Is.Not.InstanceOf<string>()); // null is not an instance of any type
Assert.That((string?)null, Is.Not.InstanceOf<string>()); // null is not an instance of any type
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This resolved an overload ambiguity. The compiler seemed to want to resolve to the Action overload

@stevenaw stevenaw marked this pull request as ready for review May 29, 2026 16:45
@stevenaw stevenaw requested a review from OsirisTerje May 29, 2026 17:31
@stevenaw
Copy link
Copy Markdown
Member Author

@OsirisTerje @SeanKilleen Can I ask your thoughts on merge timing of this one? It (currently) organizes these pages from an NUnit 5-first perspective, leaving previous behavior for a section later down the page.

NUnit 5 should be pretty soon I think, but should we still wait to merge until after v5?

@stevenaw stevenaw requested a review from SeanKilleen May 29, 2026 17:34
@SeanKilleen
Copy link
Copy Markdown
Member

@stevenaw I'm on a family vacation but will aim to provide comments tomorrow.

@OsirisTerje
Copy link
Copy Markdown
Member

OsirisTerje commented May 29, 2026

@stevenaw

I was thinking about the same. Normally we just add a small note when we have added something, but for this major release there are whole major sections that needs a rewrite.

Option 1 is to move all current documentation into a separate folder for Version 3 and 4 documentation. That would leave a lot of documentation unchanged, and all external links in to ours would be broken, as we don't use permalinks. Alternatively move it to a separate web site. e.g. docs.v4.nunit.org. External links would always point to the new pages, so it might be hard to find.
Option 2 is to just move the V3 and 4 section down the page, as you mention, and mark that as for the V3/4, and do this only where applicable. This is the easy way out.

For Option two we could also add links at the top for going to V3/4, if the page is too large.

PS: I like the way you written it in this PR. Not sure if it scales for everything we have to change, like https://docs.nunit.org/articles/nunit/writing-tests/assertions/assertion-models/constraint.html if we change the basic language as discussed in #5244 and #5221

PS2: Perhaps DocFX can do something for us here, I read about Multi-Docset configurations.... @SeanKilleen ?

PS3: Or we could use the git versions, and mark the major version changes (tags), and publish one site per version, and only the current goes to the default doc site, the others go to subsites of that. That could be doable.

@OsirisTerje
Copy link
Copy Markdown
Member

NUnit 5 should be pretty soon I think, but should we still wait to merge until after v5?

Was hoping to get v5 out by the end of May..... oops, too soon perhaps, but early June would be nice.
So once we agree on how to handle the versioning, just merge.

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.

NUnit 5 | Document that ThrowsAsync returns a Task

3 participants