Exemple #1
0
 /// <summary>
 /// Dispose 方法
 /// </summary>
 /// <param name="disposing"></param>
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         ResizeService.Unsubscribe(this);
     }
 }
        public async Task SubscribeAndUnsubcribe_SingleSubscription()
        {
            var customResizeOptioons = new ResizeOptions();

            Action <ListenForResizeCallbackInfo> feedbackCaller = (x) =>
            {
                if (x.ListenerId == default)
                {
                    throw new ArgumentException();
                }

                SetupJsMockForUnsubscription(x.ListenerId);
            };

            SetupJsMockForSubscription(customResizeOptioons, feedbackCaller);
            var subscriptionId = await _service.Subscribe((BrowserWindowSize size) => { }, null);

            var result = await _service.Unsubscribe(subscriptionId);

            result.Should().BeTrue();

            _jsruntimeMock.Verify();
        }