title: Correct way of checking if a ICollection is actually read-only
body: <p>There is my model class</p>
  
  <pre><code>public class Model 
  {
      public ICollection&lt;string&gt; MyCollection { get; }
  }
  </code></pre>
  
  <p>I want to test <code>MyCollection</code> getter returns an <strong>actual</strong> read-only collection. That is clients of the class can neither add nor remove elements to/from it at all. What's the correct way to write such test?</p>
  
  <p><strong>Option 1</strong></p>
  
  <pre><code>Assert.That(modelInstance.MyCollection is IReadonlyCollection&lt;string&gt;);
  </code></pre>
  
  <p>It's returns true e.g when field of the <code>MyCollection</code> property is an instance of <code>List&lt;string&gt;</code> (it implements <code>IReadonlyCollection&lt;string&gt;</code>).</p>
  
  <p><strong>Option 2</strong></p>
  
  <pre><code>var testDelegate = () =&gt; modelInstance.MyCollection.Add("QWERTY");
  Assert.That(testDelegate, Throws.TypeOf&lt;NotSupportedException&gt;());
  </code></pre>
  
  <p>I find it not elegant since probably there are other ways to modificate a returned collection (such as indexers for <code>List&lt;string&gt;</code>)</p>
  
  <p>So is changing of type of the property to <code>ReadOnlyCollection&lt;string&gt;</code> the only solution to achieve needed behavior? At that case I do need any unit tests but it does the type of the <code>MyCollection</code> more specific.</p>