I don't believe there's any direct way of asking NUnit to use different datapoints of the same type for different theories. However there are two possible ways you can work around:
The first is to use different TextFixture classes for the tests that require different datapoint values:
[TestFixture]
public class BadMathsAdditionTest
{
// Ideally I want 2 x different datapoints - one for Add, and a different one for divide
[Datapoints]
private Tuple<int, int>[] _points = new Tuple<int, int>[]
{
new Tuple<int, int>(20, 10),
new Tuple<int, int>(-10, 0),
};
// add tests that use these datapoints
[Theory]
public void AddTheory(Tuple<int, int> point)
{
Assume.That((long)point.Item1 + (long)point.Item2 < (long)int.MaxValue);
Assert.That(point.Item1 + point.Item2, Is.EqualTo(new BadMaths().BadAdd(point.Item1, point.Item2)));
}
}
[TestFixture]
public class BadMathsDivisionTest
{
// Ideally I want 2 x different datapoints - one for Add, and a different one for divide
[Datapoints]
private Tuple<int, int>[] _points = new Tuple<int, int>[]
{
new Tuple<int, int>(20, 10),
};
// add test that use these datapoints
}
The second method requires a bit more work but arguably gives more readable code is to wrap each datapoint set in a different struct, like this:
// C.U.T.
public class BadMaths
{
public int BadAdd(int x, int y) { return x + y - 1; }
public int Divide(int x, int y) { return x / y; }
}
[TestFixture]
public class BadMathsTest
{
public struct AdditionData
{
public int First { get; set; }
public int Second { get; set; }
}
[Datapoints]
private AdditionData[] _points = new AdditionData[]
{
new AdditionData{First=20, Second=10},
new AdditionData{First=-10, Second=0}
};
public struct DivisionData
{
public int First { get; set; }
public int Second { get; set; }
}
[Datapoints]
private DivisionData[] _points2 = new DivisionData[]
{
new DivisionData{First=20, Second=10},
};
[Theory]
public void AddTheory(AdditionData point)
{
Assume.That((long)point.First + (long)point.Second < (long)int.MaxValue);
Assert.That(point.First + point.Second, Is.EqualTo(new BadMaths().BadAdd(point.First, point.Second)));
}
[Theory]
public void DivideTheory(DivisionData point)
{
Assume.That(point.Second != 0); // Actually you probably want to keep this condition anyway. Second==0 would be a separate test
Assert.That(point.First / point.Second, Is.EqualTo(new BadMaths().Divide(point.First, point.Second)));
}
}