Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions docs/articles/nunit/V5BreakingChanges.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,25 @@ Issue [#3669](https://github.com/nunit/nunit/issues/3669)
| `NETCore` | modern .NET | modern .NET |
| `DotNETCore` | modern .NET | modern .NET |

### Has.One.Matches changed predicate type to nullable.

Issue [#5453](https://github.com/nunit/nunit/issues/5453)

* **Why:** Aligning actual and expected type at compile-time, as lists can still have null values in them in certain cases.
* **What changed:** Has.One.Matches changed predicate type to nullable. This breaks build if nullable-warnings are treated as errors. `<WarningsAsErrors>nullable</WarningsAsErrors>`
* **What to do:** Predicates need to be change to handle potentially null-values:

```csharp
List<string> testList = ["hello", "world"];
// NUnit 4
Assert.That(testList, Has.One.Matches<string>(word => word.Length == 5));

// NUnit 4
Assert.That(testList, Has.One.Matches<string>(word => word?.Length == 5)); //Safe-Navigation
// or
Assert.That(testList, Has.One.Matches<string>(word => word!.Length == 5)); //Null-Forgiving
```

## Platform changes

### .NET 6 target removed
Expand Down
1 change: 1 addition & 0 deletions docs/articles/nunit/release-notes/framework.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ There are in total 48 issues fixed in this release.

### The following issues are marked as breaking changes

* [5453](https://github.com/nunit/nunit/issues/5453) Has.One.Matches changed predicate type to nullable. (only if nullable-warnings are treated as errors)
* [5373](https://github.com/nunit/nunit/issues/5373) Eliminate forced stop from the API. Thanks to NUnit Team member [Manfred Brands](https://github.com/manfred-brands) for [PR 5374](https://github.com/nunit/nunit/pull/5374)
* [5367](https://github.com/nunit/nunit/issues/5367) Eliminate StopRun(bool) method from .NET Core builds. Thanks to [CharliePoole](https://github.com/CharliePoole) for [PR 5369](https://github.com/nunit/nunit/pull/5369)
* [5323](https://github.com/nunit/nunit/issues/5323) Report compiler error when asserting non-attribute in `Has.Attribute&lt;T&gt;()`. Thanks to NUnit Team member [Steven Weerdenburg](https://github.com/stevenaw) for [PR 5322](https://github.com/nunit/nunit/pull/5322)
Expand Down
Loading