public static void TestDispose() { using (V2HmacStream <Stream> stream = V2HmacStream.Create(new V2HmacCalculator(new SymmetricKey(new byte[512])))) { stream.Dispose(); Assert.DoesNotThrow(() => stream.Dispose()); Assert.Throws <ObjectDisposedException>(() => stream.Write(new byte[1], 0, 1)); } }