@@ -17,35 +17,41 @@ namespace CommonExtendedObjectsTests
1717 public class IntArrayTests
1818 {
1919 /// <summary>
20- /// The size
20+ /// The size
2121 /// </summary>
2222 private const int Size = 1_000_000 ;
2323
2424 /// <summary>
25- /// Indexings the should get and set values correctly.
25+ /// Indexing the should get and set values correctly.
2626 /// </summary>
2727 [ TestMethod ]
2828 public void IndexingShouldGetAndSetValuesCorrectly ( )
2929 {
3030 var arr = new IntArray ( 5 ) ;
31- for ( int i = 0 ; i < arr . Length ; i ++ )
31+ for ( var i = 0 ; i < arr . Length ; i ++ )
32+ {
3233 arr [ i ] = i * 10 ;
34+ }
3335
34- for ( int i = 0 ; i < arr . Length ; i ++ )
36+ for ( var i = 0 ; i < arr . Length ; i ++ )
37+ {
3538 Assert . AreEqual ( i * 10 , arr [ i ] ) ;
39+ }
3640
3741 arr . Dispose ( ) ;
3842 }
3943
4044 /// <summary>
41- /// Removes at should remove element and shift left.
45+ /// Removes at should remove element and shift left.
4246 /// </summary>
4347 [ TestMethod ]
4448 public void RemoveAtShouldRemoveElementAndShiftLeft ( )
4549 {
4650 var arr = new IntArray ( 5 ) ;
47- for ( int i = 0 ; i < arr . Length ; i ++ )
51+ for ( var i = 0 ; i < arr . Length ; i ++ )
52+ {
4853 arr [ i ] = i ;
54+ }
4955
5056 arr . RemoveAt ( 2 ) ;
5157
@@ -56,7 +62,7 @@ public void RemoveAtShouldRemoveElementAndShiftLeft()
5662 }
5763
5864 /// <summary>
59- /// Resizes the should change length and preserve old data.
65+ /// Resizes the should change length and preserve old data.
6066 /// </summary>
6167 [ TestMethod ]
6268 public void ResizeShouldChangeLengthAndPreserveOldData ( )
@@ -77,25 +83,29 @@ public void ResizeShouldChangeLengthAndPreserveOldData()
7783 }
7884
7985 /// <summary>
80- /// Clears the should zero out all elements.
86+ /// Clears the should zero out all elements.
8187 /// </summary>
8288 [ TestMethod ]
8389 public void ClearShouldZeroOutAllElements ( )
8490 {
8591 var arr = new IntArray ( 4 ) ;
86- for ( int i = 0 ; i < arr . Length ; i ++ )
92+ for ( var i = 0 ; i < arr . Length ; i ++ )
93+ {
8794 arr [ i ] = 42 ;
95+ }
8896
8997 arr . Clear ( ) ;
9098
91- for ( int i = 0 ; i < arr . Length ; i ++ )
99+ for ( var i = 0 ; i < arr . Length ; i ++ )
100+ {
92101 Assert . AreEqual ( 0 , arr [ i ] ) ;
102+ }
93103
94104 arr . Dispose ( ) ;
95105 }
96106
97107 /// <summary>
98- /// Compares the int array vs int array dot net performance.
108+ /// Compares the int array vs int array dot net performance.
99109 /// </summary>
100110 [ TestMethod ]
101111 public void CompareIntArrayvsIntArrayDotNetPerformance ( )
@@ -106,12 +116,16 @@ public void CompareIntArrayvsIntArrayDotNetPerformance()
106116 var intArray = new IntArray ( Size ) ;
107117 stopwatch . Restart ( ) ;
108118
109- for ( int i = 0 ; i < Size ; i ++ )
119+ for ( var i = 0 ; i < Size ; i ++ )
120+ {
110121 intArray [ i ] = i ;
122+ }
111123
112124 long intArraySum = 0 ;
113- for ( int i = 0 ; i < Size ; i ++ )
125+ for ( var i = 0 ; i < Size ; i ++ )
126+ {
114127 intArraySum += intArray [ i ] ;
128+ }
115129
116130 stopwatch . Stop ( ) ;
117131 var customTime = stopwatch . ElapsedMilliseconds ;
@@ -123,12 +137,16 @@ public void CompareIntArrayvsIntArrayDotNetPerformance()
123137 var nativeArray = new int [ Size ] ;
124138 stopwatch . Restart ( ) ;
125139
126- for ( int i = 0 ; i < Size ; i ++ )
140+ for ( var i = 0 ; i < Size ; i ++ )
141+ {
127142 nativeArray [ i ] = i ;
143+ }
128144
129145 long nativeSum = 0 ;
130- for ( int i = 0 ; i < Size ; i ++ )
146+ for ( var i = 0 ; i < Size ; i ++ )
147+ {
131148 nativeSum += nativeArray [ i ] ;
149+ }
132150
133151 stopwatch . Stop ( ) ;
134152 var nativeTime = stopwatch . ElapsedMilliseconds ;
@@ -146,16 +164,18 @@ public void CompareIntArrayvsIntArrayDotNetPerformance()
146164 }
147165
148166 /// <summary>
149- /// Removes the multiple should remove sequential indices.
167+ /// Removes the multiple should remove sequential indices.
150168 /// </summary>
151169 [ TestMethod ]
152170 public void RemoveMultipleShouldRemoveSequentialIndices ( )
153171 {
154172 var arr = new IntArray ( 10 ) ;
155- for ( int i = 0 ; i < arr . Length ; i ++ )
173+ for ( var i = 0 ; i < arr . Length ; i ++ )
174+ {
156175 arr [ i ] = i + 1 ; // [1..10]
176+ }
157177
158- var toRemove = new int [ ] { 3 , 4 , 5 } ; // remove elements at indices 3,4,5 (4th,5th,6th elements)
178+ var toRemove = new [ ] { 3 , 4 , 5 } ; // remove elements at indices 3,4,5 (4th,5th,6th elements)
159179
160180 var sw = Stopwatch . StartNew ( ) ;
161181 arr . RemoveMultiple ( toRemove ) ;
@@ -178,16 +198,18 @@ public void RemoveMultipleShouldRemoveSequentialIndices()
178198 }
179199
180200 /// <summary>
181- /// Removes the multiple should remove non sequential indices.
201+ /// Removes the multiple should remove non sequential indices.
182202 /// </summary>
183203 [ TestMethod ]
184204 public void RemoveMultipleShouldRemoveNonSequentialIndices ( )
185205 {
186206 var arr = new IntArray ( 10 ) ;
187- for ( int i = 0 ; i < arr . Length ; i ++ )
207+ for ( var i = 0 ; i < arr . Length ; i ++ )
208+ {
188209 arr [ i ] = i + 1 ; // [1..10]
210+ }
189211
190- var toRemove = new int [ ] { 1 , 3 , 6 } ; // remove elements at indices 1,3,6
212+ var toRemove = new [ ] { 1 , 3 , 6 } ; // remove elements at indices 1,3,6
191213
192214 var sw = Stopwatch . StartNew ( ) ;
193215 arr . RemoveMultiple ( toRemove ) ;
@@ -200,7 +222,7 @@ public void RemoveMultipleShouldRemoveNonSequentialIndices()
200222 // Remaining elements: indices 0,2,4,5,7,8,9
201223 // Values: 1, 3, 5, 6, 8, 9, 10
202224 int [ ] expected = { 1 , 3 , 5 , 6 , 8 , 9 , 10 } ;
203- for ( int i = 0 ; i < arr . Length ; i ++ )
225+ for ( var i = 0 ; i < arr . Length ; i ++ )
204226 {
205227 Assert . AreEqual ( expected [ i ] , arr [ i ] ) ;
206228 }
0 commit comments