Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Support for Theory instead of Fact attribute ?
marmantrout
#1 Posted : Thursday, January 5, 2023 6:10:32 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 1/5/2023(UTC)
Posts: 2
Location: United States of America

Is there support for the [Theory] instead of the [Fact] attribute ? If so is there any documentation on it ?

Micah
Remco
#2 Posted : Thursday, January 5, 2023 11:06:18 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,123

Thanks: 957 times
Was thanked: 1286 time(s) in 1193 post(s)
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?
marmantrout
#3 Posted : Thursday, January 5, 2023 11:23:40 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 1/5/2023(UTC)
Posts: 2
Location: United States of America

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 )
{
Remco
#4 Posted : Friday, January 6, 2023 7:54:16 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,123

Thanks: 957 times
Was thanked: 1286 time(s) in 1193 post(s)
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.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.030 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download