public void Test_ExceptionRemoveAtListIsReadOnly() { var intList = new ListCollection <int> { 1, 2, 3, 4, 5 }; intList.AsReadOnly(); var checkGet = Assert.Throws <NotSupportedException>(() => intList.RemoveAt(2)); Assert.Equal("List is readonly!", checkGet.Message); }