title: PACT .NET consumer test: flexible length array
body: <p>I am using pactNet to test an API which should return an array of a flexible length.</p>
  
  <p>If i call "myApi/items/" it should return a list of items where the consumer does not know the exact size of.
  So the answer should look like this:</p>
  
  <pre><code>    [
          {
              "id": "1",
              "description": "foo"
          },
          {
              "id": "2",
              "description": "foo2"
          },
          {
              "id": "3",
              "description": "foo3"
          }
      ]
  </code></pre>
  
  <p>or this:</p>
  
  <pre><code>    [
          {
              "id": "4",
              "description": "foo4"
          },
          {
              "id": "2",
              "description": "foo2"
          }
      ]
  </code></pre>
  
  <p>How do I create the contract for this interaction?</p>
  
  <p>In the <a href="https://docs.pact.io/documentation/matching.html" rel="nofollow noreferrer">documentation</a> is an example in Ruby, but I cannot find the equivalent in C#.</p>
  
  <p>I am using pactNet version 2.1.1.</p>
  
  <p>Edit: Here is an example how it should look like. What I want to know is how do I declare that the body should contain an array of items with a flexible length.</p>
  
  <pre><code>[Test]
      public void GetAllItems()
      {
          //Arrange
          _mockProviderService
              .Given("There are items")
              .UponReceiving("A GET request to retrieve the items")
              .With(new ProviderServiceRequest
              {
                  Method = HttpVerb.Get,
                  Path = "/items/",
                  Headers = new Dictionary&lt;string, object&gt;
                  {
                      { "Accept", "application/json" }
                  }
              })
              .WillRespondWith(new ProviderServiceResponse
              {
                  Status = 200,
                  Headers = new Dictionary&lt;string, object&gt;
                  {
                      { "Content-Type", "application/json; charset=utf-8" }
                  },
                  Body = // array of items with some attributes
                         // (somthing like: {"id": "2", "description": "foo"}) 
                         // with flexible length
              });
  
          var consumer = new ItemApiClient(_mockProviderServiceBaseUri);
  
          //Act
          var result = consumer.GetItems();
  
          //Assert
          Assert.AreEqual(true, result.Count &gt; 0);
  
          _mockProviderService.VerifyInteractions();
  
          data.Dispose();
      }
  </code></pre>