Core Framework v2 2.9.1 2024 September 22
Today, we're shipping one new release and two new prereleases:
- xUnit.net Core Framework v2
2.9.1 - xUnit.net Core Framework v3 0.4.0-pre.20 (release notes)
- xUnit.net Visual Studio adapter 3.0.0-pre.35 (release notes)
It's been 3 months since the release of 2.9.0.
As always, we'd like to thank all the users who contributed to the success of xUnit.net through usage, feedback, and code. 🎉
Release Notes
These release notes are a comprehensive list of changes from 2.9.0 to 2.9.1.
Core Framework
We have added collection initializer support for
TheoryData<T>, so that you can now write the following code to initialize aTheoryData<T>:public static TheoryData<int> IntValues = [42, 2112, 2600];Note that this changes
TheoryData<T>such that the "primary" enumeration implementation isIEnumerable<T>, so any code that was previously depending on it returningIEnumerable<object[]>may need to be rewritten (i.e., casting the data toIEnumerable<object[]>explicitly before enumerating).We have updated the JUnit XML report output based on https://github.com/testmoapp/junitxml?tab=readme-ov-file, which should provide a more up-to-date report result. xunit/xunit#2979
BUG: We have restored a mistakenly removed method (
TestInvoker<T>.GetTaskFromResult), albeit hidden from Intellisense. The correct method to use moving forward isAsyncUtility.TryConvertToTask, which provides the same functionality as the restored method. xunit/xunit#3026
Assertion Library
We have added support for
Guidvalues toAssert.Equivalent. xunit/xunit#2974We have added support for
Lazy<T>values toAssert.Equivalent. When encountered anywhere in the expected and/or actual side of the comparison, the underlying value will be compared.We have added support for
IEnumerable<IGrouping<TKey, TValue>>toAssert.Equivalent. We have also added support for this toArgumentFormatter, which should allow properly displaying groupings rather than falling back to the triple-ellipses display. (Note: UsingAssert.Equalwith groupings will cause false positives due of the factIGrouping<>implementsIEnumerable<TValue>, so the containers only compare values and not keys. OnlyAssert.Equivalentis supported for comparing two groupings.) xunit/xunit#3028BUG: We have fixed an issue with compiler ambiguity related to arrays and spans (for .NET 6+ users) by adding an additional overload (
Equal<T>(ReadOnlySpan<T>, T[]). xunit/xunit#3021