Skip to content

Commit

Permalink
Fix SetOptions on OverviewMap
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaudleclerc committed Apr 13, 2021
1 parent 0831897 commit 97da5ee
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public async ValueTask SetOptionsAsync(Action<OverviewMapControlOptions> 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);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<object[]>(parameters =>
(parameters[0] as Guid?).GetValueOrDefault().ToString() == control.Id.ToString()
&& (parameters[1] as OverviewMapControlOptions) == control.Options
)), Times.Once);
_jsRuntimeMock.VerifyNoOtherCalls();
}

Expand All @@ -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<object[]>(parameters =>
(parameters[0] as Guid?).GetValueOrDefault().ToString() == control.Id.ToString()
&& (parameters[1] as OverviewMapControlOptions) == control.Options
)), Times.Once);
_jsRuntimeMock.VerifyNoOtherCalls();
}

Expand All @@ -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<object[]>(parameters =>
(parameters[0] as Guid?).GetValueOrDefault().ToString() == control.Id.ToString()
&& (parameters[1] as OverviewMapControlOptions) == control.Options
)), Times.Once);
_jsRuntimeMock.VerifyNoOtherCalls();
}

Expand All @@ -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<object[]>(parameters =>
(parameters[0] as Guid?).GetValueOrDefault().ToString() == control.Id.ToString()
&& (parameters[1] as OverviewMapControlOptions) == control.Options
)), Times.Once);
_jsRuntimeMock.VerifyNoOtherCalls();
}
}
Expand Down

0 comments on commit 97da5ee

Please sign in to comment.