Esempio n. 1
0
        public async void Should_TogglePopupAsync()
        {
            var assertEvent       = false;
            var popupInvokeHelper = new PopupInvokeHelper(null);
            var marker            = new HtmlMarker(new HtmlMarkerOptions {
                Popup = new HtmlMarkerPopup(new PopupOptions())
                {
                    IsRemoved = true
                }
            })
            {
                JSRuntime         = _jsRuntime.Object,
                PopupInvokeHelper = popupInvokeHelper
            };

            marker.OnPopupToggled += () => assertEvent = true;
            await marker.TogglePopupAsync();

            Assert.True(assertEvent);
            Assert.True(marker.Options.Popup.HasBeenToggled);
            Assert.False(marker.Options.Popup.IsRemoved);

            _jsRuntime.Verify(runtime => runtime.InvokeVoidAsync(Constants.JsConstants.Methods.HtmlMarker.TogglePopup.ToHtmlMarkerNamespace(), It.Is <object[]>(parameters =>
                                                                                                                                                                parameters[0] as string == marker.Id &&
                                                                                                                                                                parameters[1] as string == marker.Options.Popup.Id &&
                                                                                                                                                                parameters[2] is IEnumerable <string> &&
                                                                                                                                                                parameters[3] is DotNetObjectReference <PopupInvokeHelper>
                                                                                                                                                                )));
            _jsRuntime.VerifyNoOtherCalls();
        }
Esempio n. 2
0
        public async void Should_Not_TogglePopupAsync()
        {
            var assertEvent       = false;
            var popupInvokeHelper = new PopupInvokeHelper(null);
            var marker            = new HtmlMarker(new HtmlMarkerOptions())
            {
                JSRuntime         = _jsRuntime.Object,
                PopupInvokeHelper = popupInvokeHelper
            };

            marker.OnPopupToggled += () => assertEvent = true;
            await marker.TogglePopupAsync();

            Assert.False(assertEvent);

            _jsRuntime.VerifyNoOtherCalls();
        }
Esempio n. 3
0
        public async void Should_Not_TogglePopup_NotAddedToMapCase_Async()
        {
            var popupInvokeHelper = new PopupInvokeHelper(null);
            var marker            = new HtmlMarker(new HtmlMarkerOptions {
                Popup = new HtmlMarkerPopup(new PopupOptions())
                {
                    IsRemoved = true
                }
            })
            {
                PopupInvokeHelper = popupInvokeHelper
            };

            await Assert.ThrowsAnyAsync <ComponentNotAddedToMapException>(async() => await marker.TogglePopupAsync());

            _jsRuntime.VerifyNoOtherCalls();
        }