Datapoint(s)Attribute should work on IEnumerable<T> as well as on Arrays
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
NUnit Framework |
Fix Released
|
High
|
Charlie Poole | ||
NUnit V2 |
Fix Released
|
High
|
Charlie Poole |
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()
{
foreach (MySpecialEnum setting in
Enum.GetValues(
{
}
return settings;
}
//prepare datapoints
[Datapoints]
public static List<MySpecialEnum> settingValues = PrepareList();
//create theory
[Theory]
public void CTATheorySample
{
Assume.
}
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
Changed in nunitv2: | |
status: | New → Confirmed |
importance: | Undecided → High |
assignee: | nobody → Charlie Poole (charlie.poole) |
tags: | added: feature |
Changed in nunit-3.0: | |
status: | New → Confirmed |
importance: | Undecided → High |
assignee: | nobody → Charlie Poole (charlie.poole) |
Changed in nunitv2: | |
milestone: | none → 2.5.5 |
Changed in nunitv2: | |
status: | Confirmed → Fix Committed |
summary: |
- DatapointsAttribute should work on IEnumerable<T> as well as arrays + Datapoint(s)Attribute should work on IEnumerable<T> as well as on Arrays |
Changed in nunit-3.0: | |
status: | Confirmed → Triaged |
milestone: | none → 2.9.4 |
Changed in nunit-3.0: | |
status: | Triaged → Fix Committed |
Changed in nunitv2: | |
status: | Fix Committed → Fix Released |
Changed in nunit-3.0: | |
status: | Fix Committed → Fix Released |
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.