Back to Xunit

Core Framework v2 2.9.1

site/releases/v2/2.9.1.md

latest2.9 KB
Original Source

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 a TheoryData<T>:

    csharp
    public static TheoryData<int> IntValues = [42, 2112, 2600];
    

    Note that this changes TheoryData<T> such that the "primary" enumeration implementation is IEnumerable<T>, so any code that was previously depending on it returning IEnumerable<object[]> may need to be rewritten (i.e., casting the data to IEnumerable<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{: .issue-link }

  • BUG: We have restored a mistakenly removed method (TestInvoker<T>.GetTaskFromResult), albeit hidden from Intellisense. The correct method to use moving forward is AsyncUtility.TryConvertToTask, which provides the same functionality as the restored method. xunit/xunit#3026{: .issue-link }

Assertion Library

  • We have added support for Guid values to Assert.Equivalent. xunit/xunit#2974{: .issue-link }

  • We have added support for Lazy<T> values to Assert.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>> to Assert.Equivalent. We have also added support for this to ArgumentFormatter, which should allow properly displaying groupings rather than falling back to the triple-ellipses display. (Note: Using Assert.Equal with groupings will cause false positives due of the fact IGrouping<> implements IEnumerable<TValue>, so the containers only compare values and not keys. Only Assert.Equivalent is supported for comparing two groupings.) xunit/xunit#3028{: .issue-link }

  • BUG: 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{: .issue-link }