コード例 #1
0
        public async void Should_GetCurrentFacilityAsync()
        {
            var currentFacility = new IndoorFacility {
                FacilityId   = "facilityId",
                LevelOrdinal = 1
            };

            _jsRuntime.Setup(runtime => runtime.InvokeAsync <IndoorFacility>(It.IsAny <string>(), It.IsAny <object[]>())).ReturnsAsync(currentFacility);

            var indoorManager = new IndoorManager(_jsRuntime.Object, _logger.Object);
            var result        = await indoorManager.GetCurrentFacilityAsync();

            Assert.Equal(currentFacility.FacilityId, result.FacilityId);
            Assert.Equal(currentFacility.LevelOrdinal, result.LevelOrdinal);

            _jsRuntime.Verify(runtime => runtime.InvokeAsync <IndoorFacility>(Constants.JsConstants.Methods.Indoor.GetCurrentFacility.ToIndoorNamespace(), indoorManager.Id), Times.Once);
            _jsRuntime.VerifyNoOtherCalls();
        }
コード例 #2
0
        public async void Should_NotGetCurrentFacility_DisposedCase_Async()
        {
            var indoorManager = new IndoorManager(_jsRuntime.Object, _logger.Object);

            await indoorManager.DisposeAsync();

            await Assert.ThrowsAnyAsync <ComponentDisposedException>(async() => await indoorManager.GetCurrentFacilityAsync());

            _jsRuntime.Verify(runtime => runtime.InvokeVoidAsync(Constants.JsConstants.Methods.Indoor.Dispose.ToIndoorNamespace(), indoorManager.Id), Times.Once);
            _jsRuntime.VerifyNoOtherCalls();
        }