private void Dispose(bool disposing) { if (_isDisposed) { return; } _timerSubscription?.Dispose(); _meterInformation.Dispose(); _simpleAudioVolume.Dispose(); _deviceMutedSubscription.Dispose(); _muteChanged.Dispose(); _stateChanged.Dispose(); _disconnected.Dispose(); _volumeChanged.Dispose(); _peakValueChanged.Dispose(); //Run this on the com thread to ensure it's disposed correctly ComThread.BeginInvoke(() => { AudioSessionControl.UnregisterAudioSessionNotification(this); }).ContinueWith(x => { _audioSessionControl.Dispose(); }); GC.SuppressFinalize(this); _isDisposed = true; }
public void Broadcaster_Dispose() { var b = new Broadcaster <int>(); b.Dispose(); Assert.True(b.IsDisposed); }
public void Broadcaster_Catches_Exception_In_Dispose() { var b = new Broadcaster <int>(); var reflectedValue = -1; b.Subscribe( x => { throw new Exception(); }, ex => { throw new Exception(); }, () => { throw new Exception(); }); b.Subscribe(x => { reflectedValue = x; }); //Assert does not throw b.OnNext(1); b.Dispose(); Assert.Equal(1, reflectedValue); }
protected virtual void Dispose(bool disposing) { _muteChanged.Dispose(); _stateChanged.Dispose(); _volumeChanged.Dispose(); _defaultChanged.Dispose(); _propertyChanged.Dispose(); _peakValueChanged.Dispose(); }
public void Filtered_Broadcaster_Is_Disposed() { var b = new Broadcaster <int>().When(x => x == 2) as FilteredBroadcaster <int>; Assert.NotNull(b); b.Dispose(); Assert.True(b.IsDisposed); }
public void Dispose() { _processTerminatedSubscription.Dispose(); _sessionCreated.Dispose(); _sessionDisconnected.Dispose(); _lock.Dispose(); Marshal.FinalReleaseComObject(_audioSessionManager); }
public void Broadcaster_Disposed_HasObservers() { var b = new Broadcaster <int>(); var sub = b.Subscribe(x => { }); Assert.NotNull(sub); b.Dispose(); Assert.False(b.HasObservers); }
public void Broadcaster_Disposed_Subscribe_Throws_Exception() { var b = new Broadcaster <int>(); b.Dispose(); Assert.True(b.IsComplete); Assert.True(b.IsDisposed); Assert.Throws <ObjectDisposedException>(() => b.Subscribe(x => { })); Assert.False(b.HasObservers); }
private void MainForm_FormClosed(object sender, FormClosedEventArgs e) { foreach (var b in driverButtons) { b.Tag = null; } if (broadcaster.IsBroadcasting) { broadcaster.Stop(); } broadcaster.Dispose(); broadcaster = null; }
public void Broadcaster_Disposed_OnCompleted() { var b = new Broadcaster <int>(); bool complete = false; var sub = b.Subscribe(x => { }, () => { complete = true; }); Assert.NotNull(sub); b.Dispose(); Assert.True(complete); }
public void Broadcaster_Disposed_Does_Not_Fire_OnNext() { var b = new Broadcaster <int>(); int result = -1; var sub = b.Subscribe(x => { result = x; }); Assert.NotNull(sub); b.Dispose(); b.OnNext(2); Assert.NotEqual(2, result); Assert.Equal(-1, result); }
public void Broadcaster_Disposed_Does_Not_Fire_OnError() { var b = new Broadcaster <int>(); var exception = new Exception("HAI"); Exception result = null; var sub = b.Subscribe(x => { }, x => result = x); Assert.NotNull(sub); b.Dispose(); b.OnError(exception); Assert.Null(result); }
public void Broadcaster_Disposed_Does_Not_Fire_OnCompleted() { var b = new Broadcaster <int>(); int count = 0; var sub = b.Subscribe(x => { }, () => { count++; }); Assert.NotNull(sub); //Dispose will call complete once b.Dispose(); //ensure it's not called again b.OnCompleted(); Assert.Equal(1, count); }
public void Filtered_Broadcaster_Completed_NotDisposed_Intiated_From_Source() { var b = new Broadcaster <int>(); var count = 0; var fo = b.When(x => true) as FilteredBroadcaster <int>; fo.Subscribe(x => { count++; }); b.Dispose(); b.OnNext(1); b.OnNext(1); b.OnNext(1); b.OnNext(1); Assert.NotNull(fo); Assert.False(fo.IsDisposed); Assert.True(fo.IsComplete); Assert.Equal(0, count); }
public void TearDown() { //Utils.SafeDelete(mDataFilePath); mBroadcaster.Dispose(); }
public void Dispose() { _broadcaster.Dispose(); }
protected virtual void Dispose(bool disposing) { _audioDeviceChanged.Dispose(); }