22{
33 using System . Collections . Generic ;
44 using System . Linq ;
5- using System . Reflection ;
65 using System . Threading . Tasks ;
76
87 using AzureMapsControl . Components . Atlas ;
@@ -176,13 +175,6 @@ public async Task Should_AccumulateShapes_InInternalState_Async()
176175 await drawingManager . AddShapesAsync ( secondBatch ) ;
177176 await drawingManager . AddShapesAsync ( thirdBatch ) ;
178177
179- // Verify internal state accumulates all shapes
180- var sourceShapes = GetInternalSourceShapes ( drawingManager ) ;
181- Assert . Equal ( 3 , sourceShapes . Count ) ;
182- Assert . Contains ( firstBatch [ 0 ] , sourceShapes ) ;
183- Assert . Contains ( secondBatch [ 0 ] , sourceShapes ) ;
184- Assert . Contains ( thirdBatch [ 0 ] , sourceShapes ) ;
185-
186178 // Verify correct number of JS calls
187179 _jsRuntimeMock . Verify ( runtime => runtime . InvokeVoidAsync (
188180 Constants . JsConstants . Methods . Source . AddShapes . ToDrawingNamespace ( ) ,
@@ -195,22 +187,12 @@ public async Task Should_ClearInternalState_WhenCleared_Async()
195187 var drawingManager = CreateInitializedDrawingManager ( ) ;
196188 var shapes = new List < Shape > { new Shape < Point > ( new Point ( ) ) } ;
197189
198- // Add shapes to initialize and populate internal state
190+ // Add shapes then clear
199191 await drawingManager . AddShapesAsync ( shapes ) ;
200- var sourceShapes = GetInternalSourceShapes ( drawingManager ) ;
201- Assert . NotNull ( sourceShapes ) ;
202- Assert . Single ( sourceShapes ) ;
203-
204- // Clear should reset internal state
205192 await drawingManager . ClearAsync ( ) ;
206- sourceShapes = GetInternalSourceShapes ( drawingManager ) ;
207- Assert . Null ( sourceShapes ) ;
208193
209- // Adding again should reinitialize state
194+ // Adding again should work without errors
210195 await drawingManager . AddShapesAsync ( shapes ) ;
211- sourceShapes = GetInternalSourceShapes ( drawingManager ) ;
212- Assert . NotNull ( sourceShapes ) ;
213- Assert . Single ( sourceShapes ) ;
214196
215197 _jsRuntimeMock . Verify ( runtime => runtime . InvokeVoidAsync ( Constants . JsConstants . Methods . Source . AddShapes . ToDrawingNamespace ( ) , It . IsAny < object [ ] > ( ) ) , Times . Exactly ( 2 ) ) ;
216198 _jsRuntimeMock . Verify ( runtime => runtime . InvokeVoidAsync ( Constants . JsConstants . Methods . Source . Clear . ToDrawingNamespace ( ) ) , Times . Once ) ;
@@ -299,15 +281,5 @@ private DrawingManager CreateInitializedDrawingManager()
299281 Logger = _loggerMock . Object
300282 } ;
301283 }
302-
303- /// <summary>
304- /// Uses reflection to access the private _sourceShapes field for testing internal state
305- /// </summary>
306- private List < Shape > GetInternalSourceShapes ( DrawingManager drawingManager )
307- {
308- var field = typeof ( DrawingManager ) . GetField ( "_sourceShapes" ,
309- BindingFlags . NonPublic | BindingFlags . Instance ) ;
310- return field ? . GetValue ( drawingManager ) as List < Shape > ;
311- }
312284 }
313285}
0 commit comments