public void AddFiveElementsAssertCountFive() { var arrayList = new ArrayLists <int>(); for (int i = 0; i < 5; i++) { arrayList.Add(i); } Assert.AreEqual(5, arrayList.Count); }
public void AddFourItemsAssertItemIsPresentAndNonAddedItemIsNotPresent() { var arrayList = new ArrayLists <int>(); for (int i = 0; i < 4; i++) { arrayList.Add(i); } Assert.IsTrue(arrayList.Contains(1)); Assert.IsFalse(arrayList.Contains(5)); }
public void AddFiveElementsThenClearAssertInitialSizeAndSizeZero() { var arrayList = new ArrayLists <int>(); for (int i = 0; i < 5; i++) { arrayList.Add(i); } arrayList.Clear(); Assert.AreEqual(4, arrayList.InitialSize); Assert.AreEqual(0, arrayList.Count); }
public void AddFiveElementsAssertElementsAddedInOrder() { var arrayList = new ArrayLists <int>(); for (int i = 0; i < 5; i++) { arrayList.Add(i); } for (int i = 0; i < 5; i++) { Assert.AreEqual(i, arrayList[i]); } }
public void AddSixteenItems_RemoveNineItems_AssertCorrectBehaviourOfResize() { var arrayList = new ArrayLists <int>(); for (int i = 0; i < 16; i++) { arrayList.Add(i); } for (int k = 15; k > 6; k--) { arrayList.RemoveAt(k); } Assert.AreEqual(7, arrayList.Count); }
public void AddFiveElementsTestForEnumeration() { var arrayList = new ArrayLists <int>(); for (int i = 0; i < 5; i++) { arrayList.Add(i); } var j = 0; foreach (var item in arrayList) { Assert.AreEqual(j, item); j++; } }
public void AddFourItemsInsertItemAtIndexZero() { var arrayList = new ArrayLists <int>(); for (int i = 0; i < 4; i++) { arrayList.Add(i); } arrayList.Insert(0, 100); Assert.IsTrue(arrayList.Contains(100)); Assert.AreEqual(100, arrayList[0]); var j = 0; for (int i = 1; i < 5; i++) { Assert.AreEqual(j, arrayList[i]); j++; } }