public void WriteableReadOnlyList_IsReadOnly() { var list = new WriteableReadOnlyList <int>(new List <int> { 13 }); Assert.IsTrue(list.IsReadOnly, "Writeable read-only lists should be read-only."); }
public void List_RemoveAt_OnWriteableReadOnlyList_RemovesItem() { var source = new List <int> { 13 }; var list = new WriteableReadOnlyList <int>(source); list.RemoveAt(0); Assert.IsTrue(source.SequenceEqual(new int[] { }), "Item should be removed."); }
public void List_Insert_OnWriteableReadOnlyList_InsertsItem() { var source = new List <int> { 13 }; var list = new WriteableReadOnlyList <int>(source); list.Insert(0, 17); Assert.IsTrue(source.SequenceEqual(new[] { 17, 13 }), "Item should be inserted."); }
public void List_Clear_OnWriteableReadOnlyList_ClearsItems() { var source = new List <int> { 13 }; var list = new WriteableReadOnlyList <int>(source); list.Clear(); Assert.IsTrue(source.SequenceEqual(new int[] { }), "Items should be cleared."); }
public void List_AddItem_OnWriteableReadOnlyList_AddsItem() { var source = new List <int> { 13 }; var list = new WriteableReadOnlyList <int>(source); list.Add(17); Assert.IsTrue(source.SequenceEqual(new[] { 13, 17 }), "Item should be added."); }
public void List_SetItem_OnWriteableReadOnlyList_SetsItem() { var source = new List <int> { 13 }; var list = new WriteableReadOnlyList <int>(source); list[0] = 17; Assert.AreEqual(17, source[0], "Item at valid index should be set."); }
public void List_Remove_OnWriteableReadOnlyList_RemovesItem() { var source = new List <int> { 13 }; var list = new WriteableReadOnlyList <int>(source); bool result = list.Remove(13); Assert.IsTrue(result, "Item should be found."); Assert.IsTrue(source.SequenceEqual(new int[] { }), "Item should be removed."); }