[dotnet] Migrate remaining NUnit assertions to Assert.That
and Has.Count
#14870
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.
User description
Thanks for contributing to Selenium!
A PR well described will help maintainers to quickly review and merge it
Before submitting your PR, please check our contributing guidelines.
Avoid large PRs, help reviewers by making them as simple and short as possible.
Description
Migrates remaining assertions to
Assert.That
, including improving some hand-rolled exception assertionsMotivation and Context
Contributes to #14852
Types of changes
Checklist
PR Type
enhancement, tests
Description
Assert.That
withHas
andThrows
for improved readability and consistency.Throws
syntax for better clarity.Changes walkthrough 📝
19 files
BrowserTest.cs
Update assertion syntax for user context count check.
dotnet/test/common/BiDi/Browser/BrowserTest.cs
Has.Count.GreaterThanOrEqualTo
.NetworkEventsTest.cs
Update assertion syntax for request cookies count check.
dotnet/test/common/BiDi/Network/NetworkEventsTest.cs
Has.Count.EqualTo
.ScriptCommandsTest.cs
Update assertion syntax for realm count checks.
dotnet/test/common/BiDi/Script/ScriptCommandsTest.cs
Has.Count.EqualTo
.StorageTest.cs
Update assertion syntax for cookie count checks.
dotnet/test/common/BiDi/Storage/StorageTest.cs
Has.Count.EqualTo
.ClickScrollingTest.cs
Modify JavaScript result conversion method.
dotnet/test/common/ClickScrollingTest.cs
DriverElementFindingTest.cs
Update assertion syntax for element count checks.
dotnet/test/common/DriverElementFindingTest.cs
Has.Count.EqualTo
.ElementElementFindingTest.cs
Update assertion syntax for child element count checks.
dotnet/test/common/ElementElementFindingTest.cs
Has.Count.EqualTo
.ExecutingAsyncJavascriptTest.cs
Update assertion syntax for async JavaScript tests.
dotnet/test/common/ExecutingAsyncJavascriptTest.cs
Has.Count.EqualTo
.ExecutingJavascriptTest.cs
Update assertion syntax for JavaScript execution tests.
dotnet/test/common/ExecutingJavascriptTest.cs
Has.Length.GreaterThan
.ActionBuilderTest.cs
Update dictionary equivalence assertion syntax.
dotnet/test/common/Interactions/ActionBuilderTest.cs
FileLogHandlerTest.cs
Update assertion syntax for log file content checks.
dotnet/test/common/Internal/Logging/FileLogHandlerTest.cs
Has.Count.EqualTo
.NavigationTest.cs
Update navigation assertion syntax for async methods.
dotnet/test/common/NavigationTest.cs
Throws.Nothing
.PositionAndSizeTest.cs
Update commented assertion syntax for position tests.
dotnet/test/common/PositionAndSizeTest.cs
FirefoxDriverTest.cs
Update exception handling assertion syntax.
dotnet/test/firefox/FirefoxDriverTest.cs
RemoteWebDriverSpecificTests.cs
Update driver type check assertion syntax.
dotnet/test/remote/RemoteWebDriverSpecificTests.cs
EventFiringWebDriverTest.cs
Update exception handling assertion syntax.
dotnet/test/support/Events/EventFiringWebDriverTest.cs
LoadableComponentTests.cs
Update exception handling assertion syntax.
dotnet/test/support/UI/LoadableComponentTests.cs
SlowLoadableComponentTest.cs
Update exception handling assertion syntax.
dotnet/test/support/UI/SlowLoadableComponentTest.cs
WebDriverWaitTest.cs
Update exception handling assertion syntax.
dotnet/test/support/UI/WebDriverWaitTest.cs