title: Iterate through an IEnumerable that uses yield
body: <p>I have started unit testing my system and have a bunch of tests (using Xunit) taking the following TestData(), one vector at a time:</p>
  <pre><code>public static IEnumerable&lt;object[]&gt; TestData()
  {
     yield return new object[] { true, false };
     yield return new object[] { false, false };
     yield return new object[] { true, true };
     yield return new object[] { false, true };
  }
  </code></pre>
  <p>Now I am wondering if there is a way to (re)use the entire set within a same/single test.<br />
  For instance, here is a test I am trying to set up:</p>
  <pre><code>[Theory]
  public void CanCheckAllInOneGo()
  {
      bool error = false;
  
      // The foreach does not work
      foreach (var a in TestData())
      {
          error |= doSomething(a[0], a[1]);
      }
              
      Assert.True(error != true, &quot;doSomething() failed&quot;);
  } 
  </code></pre>
  <p>Note, in order to run one vector at a time, I previously used the following attributes:</p>
  <pre><code>[Theory]
  [MemberData(nameof(TestData))]
  </code></pre>
  <p>Maybe it is not possible because of the &quot;yield&quot;. If not, how would you do that? Thanks.</p>