This is co-released with the core framework release
2.5.0-pre.44
.
This is the first official release to support the v3 source base. There was some mostly coincidental support for v3, but now I've overhauled the tests so that by default, you are running your tests against both v2 and v3, and then in certain specific scenarios when needed you can run against just one or the other (for example, the xUnit3000 and xUnit3001 extensibility analyzers and fixers are only applicable to v2, since they are about v2-only types). The failure context now shows what you're running against (v2 or v3) when reporting a failure, so it's easier to understand if/when you have issues with your tests.
For those who contribute to the source of the analyzers, you'll notice that I did a lot of housekeeping on the source base. New and updated base classes for analyzers and fixers have been standardized across the board, the source has been cleaned up a bit, and most importantly, all fixer tests now require you to pass the fixer key so that only the exact known fixer is applied. This was kinda too loosely specified (optional integer indices), and I wanted to ensure maximum compatibility (and it should also slightly improve performance because the test system knows to only run the singular fixer).
ITheoryDataRow
in addition to object[]
to represent a row of data. This new interface allows you to provide additional metadata along
with a data row, including a skip message, a custom test display name, a timeout,
traits, and a flag which indicates whether the data row should only be run when running
explicit tests. The analyzer needed to be updated to not flag on this data type, when
used in v3 tests.
xunit/xunit#2735
void
or
Task
, and for v3 tests you can also return ValueTask
. Any other
return value is invalid. In particular, this should help people who may be accidentally
returning ValueTask
instead of Task
for v2 tests, as v2 does
not support ValueTask
.
xunit/xunit#1415
xunit/xunit#2733
[Fact]
) is
legal in a compiler sense, but we do not discover nor support them. This analyzer should trigger
on anything derived from FactAttribute
or DataAttribute
.
xunit/xunit#2277
.Count
from
a concrete collection type (f.e., List<int>
) but not from an interface
(f.e., ICollection<int>
).
xunit/xunit#2736
Assert.Fail(message)
rather than Assert.True(false, message)
or Assert.False(true, message)
.
For projects targeting older versions of xUnit.net, this analyzer & fixer does not trigger.
xunit/xunit#2521