public void AsReadOnlyShouldBeAWrapperOfList() { var readonlyList = _list.AsReadOnly(); var amount = 10; for (int i = 0; i < amount; ++i) { _list.Add(i); } Assert.AreEqual(amount, readonlyList.Count); var value = 0; foreach (var elem in readonlyList) { Assert.AreEqual(value, elem); value++; } }
public void Init() { _list = new GenericList <int>(); _readonlyList = _list.AsReadOnly(); }