public FrameMarginSubscriptionsTest()
 {
     _subs = new FrameMarginSubscriptions(
         _mappingEvents.Object,
         _textView.Object,
         (_, __) => _onMappingChange?.Invoke(),
         (_, __) => _onViewChange?.Invoke());
 }
        public void FmsIsNotLeakedDueToEvents(bool isVertical)
        {
            var subs = new FrameMarginSubscriptions(
                _mappingEvents.Object,
                _textView.Object,
                (_, __) => _onMappingChange?.Invoke(),
                (_, __) => _onViewChange?.Invoke());

            var weakSubs = new WeakReference(subs);

            subs.Subscribe(isVertical);
            subs.Unsubscribe();
            subs = null;

            RunGarbageCollector();

            Assert.Null(weakSubs.Target);
        }
        private async Task InitializeAsync(string filePath, IWpfTextView textView)
        {
            void updateHorizontalHeight(object sender, EventArgs e)
            {
                Height = textView.ViewportHeight * (textView.ZoomLevel / 100);
            }

            var props = new FrameMarginProperties(filePath);

            await UpdateAllVisualsAsync(props);

            ClipToBounds = true;

            _subscriptions = new FrameMarginSubscriptions(
                (await Global.GetPackageAsync()).Services.MappingEvents,
                textView,
                CreateHandlerForUpdateEverything(props),
                updateHorizontalHeight);

            _subscriptions.Subscribe(_isVertical);
        }