Is there support for the [Theory] instead of the [Fact] attribute ? If so is there any documentation on it ?
Micah
Daily Usage Issues
Support for Theory instead of Fact attribute ?
Started by marmantrout on 1,834 views
Remco NCrunch Developer
#16394
05 Jan 2023 23:06 UTC
Hi, thanks for posting.
The Theory attribute under xunit is supported by NCrunch and should just work out of the box. Are you experiencing any problems with it?
The Theory attribute under xunit is supported by NCrunch and should just work out of the box. Are you experiencing any problems with it?
It sees all of the Tests in the Theory as one test but there is three for Constructor_Fail?
Maybe I am doing something wrong
public static IEnumerable<object[]> GetInfoFail()
{
var loggerMock = new Mock<ILogger<Handler>>();
var eventBusMock = new Mock<IEventBus>();
var optionsMock = new Mock<IOptions<Options>>();
yield return new object[] { null, loggerMock.Object, optionsMock.Object };
yield return new object[] { eventBusMock.Object, null, optionsMock.Object };
yield return new object[] { eventBusMock.Object, loggerMock.Object, null};
}
[Theory]
[MemberData(nameof(GetInfoFail))]
public void Constructor_Fail(
IEventBus eventBus,
ILogger<Handler> logger,
IOptions<Options> Options )
{
Maybe I am doing something wrong
public static IEnumerable<object[]> GetInfoFail()
{
var loggerMock = new Mock<ILogger<Handler>>();
var eventBusMock = new Mock<IEventBus>();
var optionsMock = new Mock<IOptions<Options>>();
yield return new object[] { null, loggerMock.Object, optionsMock.Object };
yield return new object[] { eventBusMock.Object, null, optionsMock.Object };
yield return new object[] { eventBusMock.Object, loggerMock.Object, null};
}
[Theory]
[MemberData(nameof(GetInfoFail))]
public void Constructor_Fail(
IEventBus eventBus,
ILogger<Handler> logger,
IOptions<Options> Options )
{
Edited 05 Jan 2023 23:30 UTC
Remco NCrunch Developer
#16396
06 Jan 2023 07:54 UTC
In this particular case, the runner is bundling the test together either because they contain complex types that can't be reliably transferred between the analysis domain and the test domain, or because the types involved cannot be uniquely represented to form a unique test name (see here for more information).
When the tests are bundled, they will still run and report results, but NCrunch won't report them separately in the Tests Window.
When the tests are bundled, they will still run and report results, but NCrunch won't report them separately in the Tests Window.
Post a reply
Log in to reply.