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); }
#pragma warning disable CC0029 // Disposables Should Call Suppress Finalize #pragma warning disable CA1063 // Implement IDisposable Correctly public void Dispose() #pragma warning restore CA1063 // Implement IDisposable Correctly #pragma warning restore CC0029 // Disposables Should Call Suppress Finalize { _subs.Unsubscribe(); }