NUnit: How to pass TestCaseData from a non-static method?
<p>My test fails because of the message:</p>
<pre><code>The sourceName specified on a TestCaseSourceAttribute must refer to a static field, property or method.
</code></pre>
<p>This is my Code:</p>
<pre><code>const double MAX_DELTA = 0.01;
Qv_ges qv_ges_NE;
double Sum_Qv_ges_R_FL;
Qv_ges Qv_ges_Quer;

[SetUp]
public void init()
{
    qv_ges_NE = Din1946.Calc_Qv_ges_NE(205.7d);
    Sum_Qv_ges_R_FL = 15d + 15d + 15d + 15d + 15d + 10d + 10d + 10d + 10d + 10d + 10d + 10d;
    Qv_ges_Quer = Din1946.Calc_Qv_ges_Quer(qv_ges_NE, Sum_Qv_ges_R_FL);
}

public IEnumerable&lt;TestCaseData&gt; TestCases_A()
{
    yield return new TestCaseData(72.5, Qv_ges_Quer.FL.Value, MAX_DELTA);
    yield return new TestCaseData(169.17, Qv_ges_Quer.RL.Value, MAX_DELTA);
    yield return new TestCaseData(241.67, Qv_ges_Quer.NL.Value, MAX_DELTA);
    yield return new TestCaseData(314.17, Qv_ges_Quer.IL.Value, MAX_DELTA);
}

[TestCaseSource(&quot;TestCases_A&quot;)]
public void MethodA(double expected, double value, double latitude)
{
    Assert.AreEqual(expected, value, latitude);
}
</code></pre>
<p>I used only static testcase-methods, but now I need to access non staic data like the variable <code>Qv_ges_Quer</code>: <code>Qv_ges_Quer.IL.Value</code>, <code>Qv_ges_Quer.FL.Value</code>.... so I removed <code>static</code></p>
<p><strong>Question:</strong><br>
How can I use a non static testcase?<br>
I also noticed by debugging that it doesn't enter the SetUp at first.</p>
<p>This is my old code which I want to reorganize, maybe you know another/better way then the way above:</p>
<pre><code>public void MethodA()
{
    Qv_ges qv_ges_NE = Din1946.Calc_Qv_ges_NE(205.7d);

    double Sum_Qv_ges_R_FL = 15d + 15d + 15d + 15d + 15d + 10d + 10d + 10d + 10d + 10d + 10d + 10d;
    Qv_ges Qv_ges_Quer = Din1946.Calc_Qv_ges_Quer(qv_ges_NE, Sum_Qv_ges_R_FL);

    Assert.AreEqual(72.5, Qv_ges_Quer.FL.Value, MAX_DELTA);
    Assert.AreEqual(169.17, Qv_ges_Quer.RL.Value, MAX_DELTA);
    Assert.AreEqual(241.67, Qv_ges_Quer.NL.Value, MAX_DELTA);
    Assert.AreEqual(314.17, Qv_ges_Quer.IL.Value, MAX_DELTA);
}
</code></pre>