I have a test that I've written to do some general sanity testing of a degenerate class
(NullRules, an implementation of an interface I have which always returns the same value).
Since I don't care specifically what the test data is, I used NUnit's RandomAttribute to have
the test runner randomly generate a handful of test data and run it through.
This works fine in the GUI, the console runner and Resharper.
However, NCrunch is unable to execute them.
Code:
public class NullRules
{
public NullRules(int defaultValue)
{
DefaultValue = defaultValue;
}
#region Implementation of IRules
public int ApplyRules(params object[] properties)
{
return DefaultValue;
}
public int DefaultValue { get; private set; }
#endregion
}
[Test]
public void TestNullRules([Random(0,1000,10)] int value)
{
var sut = new NullRules(value);
var actual = sut.ApplyRules(false, 12321, 88.233, DateTime.Today, true, 912);
Assert.That(actual, Is.EqualTo(value));
}