title: xUnit and multiple data records for a test
body: <p>I'm fairly new to Unit Testing and have the following code:</p>
  <pre><code>public class PowerOf
  {
      public int CalcPowerOf(int @base, int exponent) {
          if (@base == 0) { return 0; }
          if (exponent == 0) { return 1; }
          return @base * CalcPowerOf(@base, exponent - 1);
      }
  }
  </code></pre>
  <p>The unit test (with xUnit) I wrote for it first was this one, but I'm not quite sure if it's the right approach, or if I should use another pattern?
  <strong>What I wanted to know</strong> is whether this is the correct usage for passing multiple sets of data into a &quot;unit test&quot; - as I didn't see any docs or reference examples on xUnit's docs?</p>
  <pre><code>    [Fact]
      public void PowerOfTest() {
          foreach(var td in PowerOfTestData()) {
             Assert.Equal(expected, CalcPowerOf(@base, exponent));
          }
      }
  
      public class TestData {
        int Base {get;set;}
        int Exponent {get;set;}
        int ExpectedResult {get;set;}
      }
  
      public List&lt;TestData&gt; PowerOfTestData() {
          yield return new TestData { Base = 0, Exponent = 0, TestData = 0 };
          yield return new TestData { Base = 0, Exponent = 1, TestData = 0 };
          yield return new TestData { Base = 2, Exponent = 0, TestData = 1 };
          yield return new TestData { Base = 2, Exponent = 1, TestData = 2 };
          yield return new TestData { Base = 5, Exponent = 2, TestData = 25 };
      }
  </code></pre>