@@ -57,42 +57,76 @@ public void RegisterServices()
5757
5858 public class AzureMapTests : IClassFixture < AzureMapFixture >
5959 {
60- private readonly AzureMapFixture _fixture ;
61- public AzureMapTests ( AzureMapFixture fixture ) => _fixture = fixture ;
62-
6360 [ Fact ]
6461 public void Should_DisplayDivWithId ( )
6562 {
66- using ( _fixture )
63+ using ( var fixture = new AzureMapFixture ( ) )
6764 {
6865 const string mapId = "mapID" ;
6966
70- _fixture . Configuration . AadAppId = "aadAppId" ;
67+ fixture . Configuration . AadAppId = "aadAppId" ;
7168
72- _fixture . Configuration . AadTenant = "aadTenant" ;
73- _fixture . Configuration . ClientId = "clientId" ;
74- _fixture . Configuration . SubscriptionKey = "subscriptionKey" ;
69+ fixture . Configuration . AadTenant = "aadTenant" ;
70+ fixture . Configuration . ClientId = "clientId" ;
71+ fixture . Configuration . SubscriptionKey = "subscriptionKey" ;
7572
76- _fixture . RegisterServices ( ) ;
73+ fixture . RegisterServices ( ) ;
7774
78- var map = _fixture . TestContext . RenderComponent < AzureMap > ( ComponentParameter . CreateParameter ( "Id" , mapId ) ) ;
75+ var map = fixture . TestContext . RenderComponent < AzureMap > ( ComponentParameter . CreateParameter ( "Id" , mapId ) ) ;
7976
8077 var mapElem = map . Find ( "div" ) ;
8178
8279 Assert . Equal ( mapId , mapElem . Attributes [ "id" ] . Value ) ;
8380
84- _fixture . JsRuntime . Verify ( runtime => runtime . InvokeVoidAsync ( Constants . JsConstants . Methods . Core . AddMap . ToCoreNamespace ( ) , It . Is < object [ ] > ( parameters =>
81+ fixture . JsRuntime . Verify ( runtime => runtime . InvokeVoidAsync ( Constants . JsConstants . Methods . Core . AddMap . ToCoreNamespace ( ) , It . Is < object [ ] > ( parameters =>
82+ parameters . Length == 5
83+ && parameters [ 0 ] as string == mapId
84+ && ( parameters [ 1 ] as AzureMapsConfiguration ) . AadAppId == fixture . Configuration . AadAppId
85+ && ( parameters [ 1 ] as AzureMapsConfiguration ) . AadTenant == fixture . Configuration . AadTenant
86+ && ( parameters [ 1 ] as AzureMapsConfiguration ) . ClientId == fixture . Configuration . ClientId
87+ && ( parameters [ 1 ] as AzureMapsConfiguration ) . SubscriptionKey == fixture . Configuration . SubscriptionKey
88+ && parameters [ 2 ] != null && parameters [ 2 ] is ServiceOptions
89+ && ( parameters [ 3 ] as IEnumerable < string > ) . Single ( ) == MapEventType . Ready . ToString ( )
90+ && parameters [ 4 ] != null && parameters [ 4 ] is DotNetObjectReference < MapEventInvokeHelper >
91+ ) ) , Times . Once ) ;
92+ fixture . JsRuntime . VerifyNoOtherCalls ( ) ;
93+ }
94+ }
95+
96+ [ Fact ]
97+ public void Should_DisplayDivWithClass ( )
98+ {
99+ using ( var fixture = new AzureMapFixture ( ) )
100+ {
101+ const string classes = "my-class-identifier other-class-identifier" ;
102+ const string mapId = "mapID" ;
103+
104+ fixture . Configuration . AadAppId = "aadAppId" ;
105+
106+ fixture . Configuration . AadTenant = "aadTenant" ;
107+ fixture . Configuration . ClientId = "clientId" ;
108+ fixture . Configuration . SubscriptionKey = "subscriptionKey" ;
109+
110+ fixture . RegisterServices ( ) ;
111+
112+ var map = fixture . TestContext . RenderComponent < AzureMap > ( ComponentParameter . CreateParameter ( "Id" , mapId ) , ComponentParameter . CreateParameter ( "Class" , classes ) ) ;
113+
114+ var mapElem = map . Find ( "div" ) ;
115+
116+ Assert . Equal ( classes , mapElem . Attributes [ "class" ] . Value ) ;
117+
118+ fixture . JsRuntime . Verify ( runtime => runtime . InvokeVoidAsync ( Constants . JsConstants . Methods . Core . AddMap . ToCoreNamespace ( ) , It . Is < object [ ] > ( parameters =>
85119 parameters . Length == 5
86120 && parameters [ 0 ] as string == mapId
87- && ( parameters [ 1 ] as AzureMapsConfiguration ) . AadAppId == _fixture . Configuration . AadAppId
88- && ( parameters [ 1 ] as AzureMapsConfiguration ) . AadTenant == _fixture . Configuration . AadTenant
89- && ( parameters [ 1 ] as AzureMapsConfiguration ) . ClientId == _fixture . Configuration . ClientId
90- && ( parameters [ 1 ] as AzureMapsConfiguration ) . SubscriptionKey == _fixture . Configuration . SubscriptionKey
121+ && ( parameters [ 1 ] as AzureMapsConfiguration ) . AadAppId == fixture . Configuration . AadAppId
122+ && ( parameters [ 1 ] as AzureMapsConfiguration ) . AadTenant == fixture . Configuration . AadTenant
123+ && ( parameters [ 1 ] as AzureMapsConfiguration ) . ClientId == fixture . Configuration . ClientId
124+ && ( parameters [ 1 ] as AzureMapsConfiguration ) . SubscriptionKey == fixture . Configuration . SubscriptionKey
91125 && parameters [ 2 ] != null && parameters [ 2 ] is ServiceOptions
92126 && ( parameters [ 3 ] as IEnumerable < string > ) . Single ( ) == MapEventType . Ready . ToString ( )
93127 && parameters [ 4 ] != null && parameters [ 4 ] is DotNetObjectReference < MapEventInvokeHelper >
94128 ) ) , Times . Once ) ;
95- _fixture . JsRuntime . VerifyNoOtherCalls ( ) ;
129+ fixture . JsRuntime . VerifyNoOtherCalls ( ) ;
96130 }
97131 }
98132 }
0 commit comments