← Back to team overview

nunit-core team mailing list archive

[Bug 1023084] Re: Add Enum support to RandomAttribute

 

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

-- 
You received this bug notification because you are a member of NUnit
Core Developers, which is the registrant for NUnit Framework.
https://bugs.launchpad.net/bugs/1023084

Title:
  Add Enum support to RandomAttribute

Status in NUnit Test Framework:
  New
Status in NUnitLite Testing Framework:
  New

Bug description:
  Add support to the Random Attribute to select a random Enum Value from
  an enumeration

  [Test]
  public void Test([Random(numberOfRandomValues)] MyEnum value)
  {
      //Random generates a Random Value from MyEnum's Values
  }

To manage notifications about this bug go to:
https://bugs.launchpad.net/nunit-3.0/+bug/1023084/+subscriptions


References