public void TestLog__AlreadyDisposed() { using (MemoryStream stream = new MemoryStream(new byte[0], true)) { StreamLogger streamLogger = new StreamLogger(stream); streamLogger.Dispose(); InvalidOperationException ex = Assert.Throws <InvalidOperationException>(delegate { streamLogger.Log(Substitute.For <ILogMessage>()); }); Assert.Contains("Object has already been disposed", ex.Message); } }