Exemple #1
0
    public static void AssertNotDisposedOrDisposingTest()
    {
        var state = new VolatileState();

        Assert.That(() => AssertionUtilities.AssertNotDisposedOrDisposing(state),
                    Throws.Nothing
                    );

        _ = state.BeginDispose();

        Assert.That(() => AssertionUtilities.AssertNotDisposedOrDisposing(state),
                    Configuration.AssertionsEnabled ? Throws.Exception : Throws.Nothing
                    );

        state.EndDispose();

        Assert.That(() => AssertionUtilities.AssertNotDisposedOrDisposing(state),
                    Configuration.AssertionsEnabled ? Throws.Exception : Throws.Nothing
                    );
    }