File tree Expand file tree Collapse file tree
src/AzureMapsControl.Components
tests/AzureMapsControl.Components.Tests/Map Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -40,7 +40,8 @@ internal enum AzureMapLogEvent
4040 AzureMap_Popup_RemoveAsync = 1033 ,
4141 AzureMap_Popup_UpdateAsync = 1034 ,
4242 AzureMap_ClearPopupsAsync = 1035 ,
43- AzureMap_PopupEventReceivedAsync = 1036
43+ AzureMap_PopupEventReceivedAsync = 1036 ,
44+ MapService_AddMapAsync = 2000
4445 }
4546
4647 internal static class Extensions
Original file line number Diff line number Diff line change 22{
33 using System . Threading . Tasks ;
44
5+ using AzureMapsControl . Components . Logger ;
6+ using Microsoft . Extensions . Logging ;
7+
58 public delegate Task MapReadyEvent ( ) ;
69
710 internal class MapService : IMapAdderService
811 {
12+ private readonly ILogger < MapService > _logger ;
13+
914 public Map Map
1015 {
1116 get ;
1217 private set ;
1318 }
1419
20+ public MapService ( ILogger < MapService > logger ) => _logger = logger ;
21+
1522 public event MapReadyEvent OnMapReadyAsync ;
1623
1724 public async Task AddMapAsync ( Map map )
1825 {
26+ _logger ? . LogAzureMapsControlInfo ( AzureMapLogEvent . MapService_AddMapAsync , "Adding instance of map" ) ;
1927 Map = map ;
2028
2129 if ( OnMapReadyAsync != null )
2230 {
31+ _logger ? . LogAzureMapsControlInfo ( AzureMapLogEvent . MapService_AddMapAsync , "Emitting OnMapReadyAsync" ) ;
2332 await OnMapReadyAsync . Invoke ( ) ;
2433 }
2534 }
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ public class MapServiceTests
1010 public async void Should_AddMap_Async ( )
1111 {
1212 var map = new Map ( "id" ) ;
13- var service = new MapService ( ) ;
13+ var service = new MapService ( null ) ;
1414 await service . AddMapAsync ( map ) ;
1515 Assert . Equal ( map , service . Map ) ;
1616 }
@@ -19,7 +19,7 @@ public async void Should_AddMap_Async()
1919 public async void Should_AddMapAndTriggerOnReady_Async ( )
2020 {
2121 var map = new Map ( "id" ) ;
22- var service = new MapService ( ) ;
22+ var service = new MapService ( null ) ;
2323
2424 var eventReceived = false ;
2525
You can’t perform that action at this time.
0 commit comments