diff --git a/src/AzureMapsControl.Components/Controls/OverviewMapControl.cs b/src/AzureMapsControl.Components/Controls/OverviewMapControl.cs index 6a88910..6d06f51 100644 --- a/src/AzureMapsControl.Components/Controls/OverviewMapControl.cs +++ b/src/AzureMapsControl.Components/Controls/OverviewMapControl.cs @@ -58,7 +58,7 @@ public async ValueTask SetOptionsAsync(Action update) Logger?.LogAzureMapsControlDebug(AzureMapLogEvent.OverviewMapControl_UpdateAsync, $"Id: {Id}"); Logger?.LogAzureMapsControlDebug(AzureMapLogEvent.OverviewMapControl_UpdateAsync, $"Type: {Type}"); - await JsRuntime.InvokeVoidAsync(Constants.JsConstants.Methods.OverviewMapControl.SetOptions.ToOverviewMapControlNamespace(), this); + await JsRuntime.InvokeVoidAsync(Constants.JsConstants.Methods.OverviewMapControl.SetOptions.ToOverviewMapControlNamespace(), Id, Options); } } diff --git a/tests/AzureMapsControl.Components.Tests/Controls/OverviewMapControl.cs b/tests/AzureMapsControl.Components.Tests/Controls/OverviewMapControl.cs index d67a69d..8407d30 100644 --- a/tests/AzureMapsControl.Components.Tests/Controls/OverviewMapControl.cs +++ b/tests/AzureMapsControl.Components.Tests/Controls/OverviewMapControl.cs @@ -37,7 +37,10 @@ public async void Should_UpdateAsync() await control.UpdateAsync(options => options.Interactive = true); Assert.True(options.Interactive); - _jsRuntimeMock.Verify(runtime => runtime.InvokeVoidAsync(Constants.JsConstants.Methods.OverviewMapControl.SetOptions.ToOverviewMapControlNamespace(), control), Times.Once); + _jsRuntimeMock.Verify(runtime => runtime.InvokeVoidAsync(Constants.JsConstants.Methods.OverviewMapControl.SetOptions.ToOverviewMapControlNamespace(), It.Is(parameters => + (parameters[0] as Guid?).GetValueOrDefault().ToString() == control.Id.ToString() + && (parameters[1] as OverviewMapControlOptions) == control.Options + )), Times.Once); _jsRuntimeMock.VerifyNoOtherCalls(); } @@ -62,7 +65,10 @@ public async void Should_SetOptionsAsync() await control.SetOptionsAsync(options => options.Interactive = true); Assert.True(options.Interactive); - _jsRuntimeMock.Verify(runtime => runtime.InvokeVoidAsync(Constants.JsConstants.Methods.OverviewMapControl.SetOptions.ToOverviewMapControlNamespace(), control), Times.Once); + _jsRuntimeMock.Verify(runtime => runtime.InvokeVoidAsync(Constants.JsConstants.Methods.OverviewMapControl.SetOptions.ToOverviewMapControlNamespace(), It.Is(parameters => + (parameters[0] as Guid?).GetValueOrDefault().ToString() == control.Id.ToString() + && (parameters[1] as OverviewMapControlOptions) == control.Options + )), Times.Once); _jsRuntimeMock.VerifyNoOtherCalls(); } @@ -86,7 +92,10 @@ public async void Should_UpdateAsyncWithDefaultOptionsAsync() await control.UpdateAsync(options => options.Interactive = true); Assert.True(control.Options.Interactive); - _jsRuntimeMock.Verify(runtime => runtime.InvokeVoidAsync(Constants.JsConstants.Methods.OverviewMapControl.SetOptions.ToOverviewMapControlNamespace(), control), Times.Once); + _jsRuntimeMock.Verify(runtime => runtime.InvokeVoidAsync(Constants.JsConstants.Methods.OverviewMapControl.SetOptions.ToOverviewMapControlNamespace(), It.Is(parameters => + (parameters[0] as Guid?).GetValueOrDefault().ToString() == control.Id.ToString() + && (parameters[1] as OverviewMapControlOptions) == control.Options + )), Times.Once); _jsRuntimeMock.VerifyNoOtherCalls(); } @@ -99,7 +108,10 @@ public async void Should_SetOptionsAsyncWithDefaultOptionsAsync() await control.SetOptionsAsync(options => options.Interactive = true); Assert.True(control.Options.Interactive); - _jsRuntimeMock.Verify(runtime => runtime.InvokeVoidAsync(Constants.JsConstants.Methods.OverviewMapControl.SetOptions.ToOverviewMapControlNamespace(), control), Times.Once); + _jsRuntimeMock.Verify(runtime => runtime.InvokeVoidAsync(Constants.JsConstants.Methods.OverviewMapControl.SetOptions.ToOverviewMapControlNamespace(), It.Is(parameters => + (parameters[0] as Guid?).GetValueOrDefault().ToString() == control.Id.ToString() + && (parameters[1] as OverviewMapControlOptions) == control.Options + )), Times.Once); _jsRuntimeMock.VerifyNoOtherCalls(); } }