File tree Expand file tree Collapse file tree
src/AzureMapsControl.Components/Map
tests/AzureMapsControl.Components.Tests/Map Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44
55 internal interface IMapAdderService : IMapService
66 {
7- ValueTask AddMapAsync ( Map map ) ;
7+ public ValueTask AddMapAsync ( Map map ) ;
88
9- ValueTask RemoveMapAsync ( string mapId ) ;
9+ public ValueTask RemoveMapAsync ( string mapId ) ;
1010 }
1111}
Original file line number Diff line number Diff line change @@ -23,12 +23,12 @@ public Map Map
2323 {
2424 get
2525 {
26- if ( ! string . IsNullOrEmpty ( _latestMapId ) && _maps . ContainsKey ( _latestMapId ) )
26+ if ( ! string . IsNullOrEmpty ( _latestMapId ) && _maps . TryGetValue ( _latestMapId , out var map ) )
2727 {
28- return _maps [ _latestMapId ] ;
28+ return map ;
2929 }
3030
31- if ( _maps . Count > 0 )
31+ if ( ! _maps . IsEmpty )
3232 {
3333 return _maps . Values . First ( ) ;
3434 }
@@ -41,10 +41,7 @@ public Map Map
4141
4242 public event MapReadyEvent OnMapReadyAsync ;
4343
44- public Map GetMap ( string mapId )
45- {
46- return _maps . TryGetValue ( mapId , out var map ) ? map : null ;
47- }
44+ public Map GetMap ( string mapId ) => _maps . TryGetValue ( mapId , out var map ) ? map : null ;
4845
4946 public async ValueTask AddMapAsync ( Map map )
5047 {
@@ -66,7 +63,7 @@ public async ValueTask RemoveMapAsync(string mapId)
6663 _logger ? . LogAzureMapsControlInfo ( AzureMapLogEvent . MapService_AddMapAsync , "Removing map instance" ) ;
6764 _logger ? . LogAzureMapsControlDebug ( AzureMapLogEvent . MapService_AddMapAsync , $ "Map ID: { mapId } ") ;
6865
69- if ( _maps . TryRemove ( mapId , out var removedMap ) )
66+ if ( _maps . TryRemove ( mapId , out _ ) )
7067 {
7168 // If we're removing the latest map, update the latest map ID
7269 if ( _latestMapId == mapId )
Original file line number Diff line number Diff line change @@ -175,7 +175,7 @@ public void Should_ReturnNull_WhenNoMapsExist()
175175 }
176176
177177 [ Fact ]
178- public async Task Should_ReturnNull_ForNonExistentMapId ( )
178+ public async Task Should_ReturnNull_ForNonExistentMapId_Async ( )
179179 {
180180 var service = new MapService ( null ) ;
181181 await service . AddMapAsync ( new Map ( "map1" ) ) ;
@@ -190,7 +190,7 @@ public async Task Should_HandleRapidAddRemoveSequence_Async()
190190 {
191191 var service = new MapService ( null ) ;
192192
193- for ( int i = 0 ; i < 5 ; i ++ )
193+ for ( var i = 0 ; i < 5 ; i ++ )
194194 {
195195 var map = new Map ( $ "map{ i } ") ;
196196 await service . AddMapAsync ( map ) ;
You can’t perform that action at this time.
0 commit comments