public static void AddRangeAndInsertRange() { var blockCollection = new BlockCollection<int>(); blockCollection.AddRange(new List<Block<int>> { new Block<int>(DefaultBlockSize) {1}, new Block<int>(DefaultBlockSize) {2} }); blockCollection.InsertRange(0, new List<Block<int>> { new Block<int>(DefaultBlockSize) {0} }); blockCollection.AddRange(new List<Block<int>> { new Block<int>(DefaultBlockSize) {3} }); blockCollection.InsertRange(4, new List<Block<int>> { new Block<int>(DefaultBlockSize) {4}, new Block<int>(DefaultBlockSize) {5} }); var checkArray = new[] { 0, 1, 2, 3, 4, 5 }; Assert.AreEqual(blockCollection.Count, checkArray.Length); for (int i = 0; i < checkArray.Length; i++) { Assert.AreEqual(blockCollection[i][0], checkArray[i]); } //Exceptions ExceptionManager.IsThrowActionException <ArgumentNullException, ICollection<Block<int>>> (blockCollection.AddRange, null); ExceptionManager.IsThrowActionException <ArgumentNullException, int, ICollection<Block<int>>> (blockCollection.InsertRange, 0, null); ExceptionManager.IsThrowActionException <ArgumentNullException, int, ICollection<Block<int>>> (blockCollection.InsertRange, -1, new Collection<Block<int>>()); ExceptionManager.IsThrowActionException <ArgumentNullException, int, ICollection<Block<int>>> (blockCollection.InsertRange, blockCollection.Count + 1, new Collection<Block<int>>()); }
public static void AddRangeAndInsertRange() { var blockCollection = new BlockCollection <int>(); blockCollection.AddRange(new List <Block <int> > { new Block <int>(DefaultBlockSize) { 1 }, new Block <int>(DefaultBlockSize) { 2 } }); blockCollection.InsertRange(0, new List <Block <int> > { new Block <int>(DefaultBlockSize) { 0 } }); blockCollection.AddRange(new List <Block <int> > { new Block <int>(DefaultBlockSize) { 3 } }); blockCollection.InsertRange(4, new List <Block <int> > { new Block <int>(DefaultBlockSize) { 4 }, new Block <int>(DefaultBlockSize) { 5 } }); var checkArray = new[] { 0, 1, 2, 3, 4, 5 }; Assert.AreEqual(blockCollection.Count, checkArray.Length); for (int i = 0; i < checkArray.Length; i++) { Assert.AreEqual(blockCollection[i][0], checkArray[i]); } //Exceptions ExceptionManager.IsThrowActionException <ArgumentNullException, ICollection <Block <int> > > (blockCollection.AddRange, null); ExceptionManager.IsThrowActionException <ArgumentNullException, int, ICollection <Block <int> > > (blockCollection.InsertRange, 0, null); ExceptionManager.IsThrowActionException <ArgumentNullException, int, ICollection <Block <int> > > (blockCollection.InsertRange, -1, new Collection <Block <int> >()); ExceptionManager.IsThrowActionException <ArgumentNullException, int, ICollection <Block <int> > > (blockCollection.InsertRange, blockCollection.Count + 1, new Collection <Block <int> >()); }