title: Mock method return value with read only property
body: <p>I wish to test a method which queries a third-party library. The library returns an object with a <code>IReadOnlyCollection</code> property. </p>
  
  <p>There is no constructor to set the value of the property and the object has no interface for me to mock.</p>
  
  <p>I have used <code>Moq</code> to mock the interface for the service that I call, but I can't create a mocked return value as I can't set the property.</p>
  
  <pre><code>public interface IHitService {
      public Hit GetHit();
  }
  
  public class Hit {
      public Hit() {
      }
  
      public IReadOnlyCollection&lt;string&gt; Result { get; }
  }
  
  public class TestingClass {
      public void MyTest() {
          Hit hit = new Hit() {
              // cannot set this property
              Result = new List&lt;string&gt;() { "hello","goodbye" };
          }
  
          Mock&lt;IHitService&gt; service = new Mock&lt;IHitService&gt;();
          service.Setup(c =&gt; c.GetHit).Returns(hit);
      }
  }
  </code></pre>
  
  <p>What would be the best way for me to generate the return value to test my method? Wrapping the object with a <code>new</code> property to hide the base does not work.</p>