public void Clear_NonEmptyList_CurrentSizeIsZero() { var list = new FixedList <int>(2); list.Append(10); list.Append(100); list.Clear(); Assert.IsTrue(list.CurrentSize == 0); }
public void IsFull_ReturnsTrue() { var list = new FixedList <int>(2); list.Append(20); list.Append(11); var isListFull = list.IsFull(); Assert.IsTrue(isListFull == true); }
public void Remove_AnyElement_ReturnsTrue() { var list = new FixedList <int>(); list.Append(2); list.Append(42); list.Append(25); var removedItem = list.Remove(2); removedItem = list.Remove(25); Assert.IsTrue(removedItem == true); Assert.IsTrue(list.CurrentSize == 1); }
public void FindIndex_ItemFound_ReturnsIndexOfFoundItem() { var list = new FixedList <int>(); list.Append(10); list.Append(100); list.Insert(45); list.InsertAfter(45, 60); list.InsertBefore(60, 85); //85 should be the second item var foundItem = list.FindIndex(85); Assert.IsTrue(foundItem == 1); }
public void FindIndex_ItemNotFound_ReturnsNegativeOne() { var list = new FixedList <int>(); list.Append(10); var notFoundItem = list.FindIndex(-100); Assert.IsTrue(notFoundItem == -1); }
public void Append_OnFullList_ReturnsFalse() { var list = new FixedList <int>(2); var result = false; result = list.Append(10); result = list.Append(100); result = list.Append(20); var lastIndex = list.FindIndex(100); //Last append should return false as Assert.IsTrue(result == false); Assert.IsTrue(list.CurrentSize == 2); //100 should be the last index at 1 for two items Assert.IsTrue(lastIndex == 1); }
public void Append_ReturnsTrue() { var list = new FixedList <int>(); var result = list.Append(10); var found = list.FindIndex(10); //Check to see if the size is 1 Assert.IsTrue(list.CurrentSize == 1); //Result should be true Assert.IsTrue(result == true); // 10 should be the only item in the list Assert.IsTrue(found == 0); }