public static void AddAndIsert() { var distributedArray = new BigArray <int>(); var size = MaxBlockSize * 2; for (int i = size / 4; i < size / 2; i++) { distributedArray.Add(i); } Assert.AreEqual(distributedArray.Count, size / 4); for (int i = 0; i < size / 4; i++) { distributedArray.Insert(i, i); } Assert.AreEqual(distributedArray.Count, size / 2); for (int i = size / 2; i < size * 3 / 4; i++) { distributedArray.Add(i); } Assert.AreEqual(distributedArray.Count, size * 3 / 4); for (int i = size * 3 / 4; i < size; i++) { distributedArray.Insert(i, i); } Assert.AreEqual(distributedArray.Count, size); //DA must be : 0,1,2,3...,n-1,n for (int i = 0; i < distributedArray.Count - 1; i++) { Assert.IsTrue(distributedArray[i] + 1 == distributedArray[i + 1]); } //Exceptions Assert.IsTrue(ExceptionManager.IsThrowActionException <ArgumentOutOfRangeException, int, int> (distributedArray.Insert, -1, 0)); Assert.IsTrue(ExceptionManager.IsThrowActionException <ArgumentOutOfRangeException, int, int> (distributedArray.Insert, distributedArray.Count + 1, 0)); }