public void ReadOnlyCollection_AttemptingToModifyCollection_Throws() { var nameValueCollection = new ReadOnlyNameValueCollection(); Assert.Throws<NotSupportedException>(() => nameValueCollection.Add("name", "value")); Assert.Throws<NotSupportedException>(() => nameValueCollection.Set("name", "value")); Assert.Throws<NotSupportedException>(() => nameValueCollection.Remove("name")); Assert.Throws<NotSupportedException>(() => nameValueCollection.Clear()); }