title: Is it possible to assert the existence of one or more elements in an array without a for loop?
body: <p>I am testing a function with XUnit. While the test correctly does the job of identifying the existence of "System.DateTime" in a returned Type[] array, I have to do so by looping through the array.  (Why test the existence of a DateTime property I already know of? Because I am learning TDD by playing with some code I'm already familiar with.)</p>
  
  <p>Is there an Assert function that can confirm the existence of an element in array? I am asking question because, while it works, I can't help but wonder if there is any more efficient or compact way of doing this besides looping through the array.</p>
  
  <p>I was hoping there was an undocumented feature in Assert that I could take advantage of.</p>
  
  <pre><code>/// &lt;summary&gt;
  /// This tests the "GetPropertyTypes(PropertyInfo[] properties)" function to 
  /// confirm that any DateTime properties in the "TestClass" are confirmed as existing.
  /// &lt;/summary&gt;
  [Fact]
  public void ConfirmDateTimePropertiesInModelExist()
  {
      // Arrange
      PropertyInfo[] propertiesInfos = typeof(TestClass).GetProperties();
      int dateTimeCount = 0;
  
      // Act
      // The names array the list of property types in "TestClass"
      Type[] propertyTypes = ExportToExcelUtilities.GetPropertyTypes(propertiesInfos);
  
      for (int i = 0; i &lt; propertyTypes.Length; i++)
          if (propertyTypes[i] == typeof(DateTime))
              dateTimeCount++;
  
      // Assert
      // Assert that the names array contains one or more "System.DateTime" properties.
      Assert.True(dateTimeCount&gt;0,
          "Existing DateTime properties were not identified in the class.");
  }
  </code></pre>