title: How to check if QueryContainer has specific properties?
body: <p>I am generating Elasticsearch queries for the NEST Client when parsing my own simple query language. That is, the parser returns a <code>QueryDescriptor</code> (which is an alias for <code>Func&lt;QueryContainerDescriptor&lt;SearchResult&gt;, QueryContainer&gt;</code>) which then can be used to get the search results from Elasticsearch.</p>
  
  <p>When the input is a query like <code>nestedObject.someField:someValue</code>, the following method <code>GetQueryDescriptor</code> with <code>query == "nestedObject.someField:someValue"</code> would be invoked.</p>
  
  <pre class="lang-cs prettyprint-override"><code>// NestedObjectQueryToken.cs
  public Func&lt;QueryContainerDescriptor&lt;SearchResult&gt;, QueryContainer&gt; GetQueryDescriptor(string query)
  {
      // GetFieldNames() extracts the fields that the user search in from the query
      // (there could possibly be more than one field present)
      var nestedFields = query.GetFieldNames().Select(fieldName =&gt; new Field("nestedObject." + fieldName));
      return descriptor =&gt; descriptor.NestedFieldSearch(query, _ =&gt; _.Fields(fields));
  }
  </code></pre>
  
  <pre><code>// QueryDescriptorExtensions.cs
  public static QueryContainer NestedFieldSearch(this QueryContainerDescriptor&lt;SearchResult&gt; descriptor,
      string query, FieldsDescriptor nestedFields)
  {
      return descriptor.Nested(n =&gt; n
          .Path("nestedObject")
          .Query(sub =&gt; sub
              .QueryString(queryString =&gt; queryString
                  .Query(query)
                  .Fields(nestedFields))))
  }
  </code></pre>
  
  <p><code>SearchResult</code> is the class that is used for the mapping of the results.</p>
  
  <p>The <code>QueryDescriptor</code> is later applied to a <code>SearchDescriptor&lt;SearchResult&gt;</code> so that it can be used in the <code>Search</code> method of NEST.</p>
  
  <hr>
  
  <p>I expect the <code>QueryDescriptor</code> to have specific properties. In the example above, it should contain a nested query with its inner query's fields set to "nestedObject.someField".</p>
  
  <p>Now I want to test this property with a unit test, i.e. without sending the query to a server.</p>
  
  <p><strong>How can I "look inside the <code>QueryDescriptor</code>" to assert that its properties are as expected?</strong></p>