title: In Nunit parameterized test, Assert which only must pass for one case
body: <p>Is there a way to write an Assert which only has to pass sometimes (when the test method is passed arguments from [TestCase] etc)</p>
  <p>I have sql being passed to EF SqlQuery&lt;&gt;, and I want to make sure that all properties are being set to proper values.</p>
  <p>A way to test this is to make sure that none of the (string) values are null or empty.</p>
  <p>The problem is that most of the string values are optional (description, imageurl, etc), and they could be null or empty.
  The way I handled this is by taking those fields which happen to be null sometimes, and moved them into a theory.</p>
  <p>By moving them into a theory, a case failing an assert won't fail the test, but if all cases fail the assert, the test will fail.</p>
  <p>Is there a way to, in a single parameterized test, say something like</p>
  <pre class="lang-cs prettyprint-override"><code>Assert.Sometimes.That(field, Is.Not.Empty)
  </code></pre>
  <p>Here's a shortened version of what I'm using now:</p>
  <pre class="lang-cs prettyprint-override"><code>[TestCase(6237)]
  [TestCase(8165)]
  public void CanGetBookInfo(int aid)
  {
      var book = repository.BookInfo(aid);
      Assert.Multiple(
          () =&gt;
          {
              Assert.That(book.Description, Is.Not.Empty);
              Assert.That(book.Name, Is.Not.Empty);
              Assert.That(book.PhotoUrl, Is.Not.Empty);
          });
  }
  
  [TestCase(6237)]
  [TestCase(8165)]
  [Theory]
  public void CanGetBookInfoAuthor(int aid)
  {
      var book = repository.BookInfo(aid);
  
      Assume.That(book.AuthorName, Is.Not.Empty);
      Assert.That(book.AuthorName, Is.Not.Empty);
  }
  </code></pre>