Add Enum support to RandomAttribute
Bug #1023084 reported by
Tyrel Alastair Hunter
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
NUnit Framework |
Fix Released
|
Wishlist
|
Charlie Poole | ||
NUnitLite |
Fix Released
|
Wishlist
|
Tyrel Alastair Hunter |
Bug Description
Add support to the Random Attribute to select a random Enum Value from an enumeration
[Test]
public void Test([Random(
{
//Random generates a Random Value from MyEnum's Values
}
Related branches
lp:~ialastairhunter/nunitlite/nunitlite
- Charlie Poole: Needs Fixing
-
Diff: 29 lines (+4/-4)2 files modifiedsrc/framework/Runner/CommandLineOptions.cs (+2/-2)
src/tests/Program.cs (+2/-2)
Changed in nunitlite: | |
importance: | Undecided → Wishlist |
Changed in nunit-3.0: | |
importance: | Undecided → Wishlist |
Changed in nunitlite: | |
assignee: | nobody → Tyrel Alastair Hunter (ialastairhunter) |
Changed in nunitlite: | |
status: | New → Fix Committed |
Changed in nunitlite: | |
status: | In Progress → Fix Committed |
Changed in nunitlite: | |
milestone: | none → 0.8 |
Changed in nunitlite: | |
status: | Fix Committed → Fix Released |
Changed in nunit-3.0: | |
status: | New → Triaged |
milestone: | none → 2.9.6 |
Changed in nunit-3.0: | |
assignee: | nobody → Charlie Poole (charlie.poole) |
status: | Triaged → Fix Committed |
Changed in nunit-3.0: | |
status: | Fix Committed → In Progress |
status: | In Progress → Fix Released |
To post a comment you must log in.
Tyrel,
Note that Random(int n) is already defined to generate n doubles between 0.0 and 1.0 (SampleType.Raw).
You'll have to add some code to GetData to recognize that the parameter is an enum and change the SampleType to an appropriate IntRange. You can't do it in the constructor, because the parameter is not available at that point.
Charlie