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

Notification

Icon
Error

XUnit - Theory not showing all inputs
JKommer
#1 Posted : Saturday, October 29, 2016 1:43:52 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 5/1/2013(UTC)
Posts: 1
Location: United Kingdom

NCrunch does not seem to correctly detect all tests when using non-primitive type input parameters - the following code will show within NCrunch as a single test with no input arguments -

public class TestClass
{
private readonly string _input;

public TestClass(string input)
{
_input = input;
}
public override string ToString()
{
return _input;
}
}

public static IEnumerable<object[]> TestData
{
get
{
yield return new object[] { new TestClass("A")};
yield return new object[] { new TestClass("B")};
yield return new object[] { new TestClass("C")};
yield return new object[] { new TestClass("D")};

}
}


[Theory(DisplayName = "Custom Test ")]
[MemberData("TestData")]
public void Test(TestClass input) { }

This shows up as:

NCrunch:
  • Custom Test

XUnit:
  • Custom Test (input: A)
  • Custom Test (input: B)
  • Custom Test (input: C)
  • Custom Test (input: D)

Remco
#2 Posted : Saturday, October 29, 2016 3:31:31 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
Hi, thanks for posting.

This by design and is due to a technical limitation. See here for more details - http://forum.ncrunch.net/yaf_postst1935_Seperate-parameterized-tests.aspx.

And here - http://forum.ncrunch.net/yaf_postst1843_TestCases-hidden-by-NCrunch-and-not-run.aspx.
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.024 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download