public void IsDisposed()
    {
        IDisposableObservable observable = this.handler;

        Assert.False(observable.IsDisposed);
        this.handler.Dispose();
        Assert.True(observable.IsDisposed);
    }
    public async Task IsDisposed()
    {
        IDisposableObservable observable = this.handler;

        Assert.False(observable.IsDisposed);
        await this.handler.DisposeAsync();

        Assert.True(observable.IsDisposed);
    }
Esempio n. 3
0
        public static void NotDisposed(IDisposableObservable disposedValue, string?message = null)
        {
            Requires.NotNull(disposedValue, nameof(disposedValue));

            if (disposedValue.IsDisposed)
            {
                string objectName = disposedValue.GetType().FullName;
                if (message is object)
                {
                    throw new ObjectDisposedException(objectName, message);
                }
                else
                {
                    throw new ObjectDisposedException(objectName);
                }
            }
        }
Esempio n. 4
0
        public static void NotDisposed(IDisposableObservable disposedValue, string message = null)
        {
            Requires.NotNull(disposedValue, "disposedValue");

            if (disposedValue.IsDisposed)
            {
                string objectName = disposedValue != null ? disposedValue.GetType().FullName : string.Empty;
                if (message != null)
                {
                    throw new ObjectDisposedException(objectName, message);
                }
                else
                {
                    throw new ObjectDisposedException(objectName);
                }
            }
        }
Esempio n. 5
0
        public static void NotDisposed(IDisposableObservable disposedValue, string message = null)
        {
            Requires.NotNull(disposedValue, "disposedValue");

            if (disposedValue.IsDisposed)
            {
                string objectName = disposedValue != null?disposedValue.GetType().FullName : string.Empty;

                if (message != null)
                {
                    throw new ObjectDisposedException(objectName, message);
                }
                else
                {
                    throw new ObjectDisposedException(objectName);
                }
            }
        }