nunit-core team mailing list archive
-
nunit-core team
-
Mailing list archive
-
Message #00366
[Bug 556971] Re: Theory arguments not initialized correctly
The problem with the above is that the DatapointsAttribute is only recognized on an array. It should be extended to allow any
object implementing IEnumerable<T> where T is the type of the argument. Changing the the title to reflect this.
** Summary changed:
- Theory arguments not initialized correctly
+ DatapointsAttribute should work on IEnumerable<T> as well as arrays
--
DatapointsAttribute should work on IEnumerable<T> as well as arrays
https://bugs.launchpad.net/bugs/556971
You received this bug notification because you are a member of NUnit
Developers, which is subscribed to NUnit V2.
Status in NUnit V2 Test Framework: Confirmed
Bug description:
[Copied from a thread on the nunit-discuss list]
I am currently playing around with NUnit's concept of theories /
datapoints.
I want to use lists as parameter for a certain Theory(test).
My code is structured like this:
//Preparation of data
public static List<MySpecialEnum> PrepareList()
{
List<MySpecialEnum> settings = new List<MySpecialEnum>();
foreach (MySpecialEnum setting in
Enum.GetValues(typeof(MySpecialEnum)))
{
settings.Add(setting);
}
return settings;
}
//prepare datapoints
[Datapoints]
public static List<MySpecialEnum> settingValues = PrepareList();
//create theory
[Theory]
public void CTATheorySample(MySpecialEnum settingVal)
{
Assume.That(/*everything is okay with settingVal */);
}
When I try to execute the tests, no parameter is visualised in the
NUnit UI and the error "no arguments were provided" is shown in the
NUnit "errors and failures" window!
Do you have any hints or workarounds for me ??
By the way I am using NUnit 2.5.3
Best regards and thanks for any hints,
Bernie
References