public void DisposeShouldNotRemoveTraceListenerIfDebugTracesIsNotEnabled()
        {
            var logMessageListener = new LogMessageListener(false);

            logMessageListener.Dispose();
            this.testablePlatformServiceProvider.MockTraceListenerManager.Verify(mtlm => mtlm.Remove(It.IsAny <ITraceListener>()), Times.Never);
        }
        public void DisposeShouldDisposeTraceListener()
        {
            var logMessageListener = new LogMessageListener(true);

            logMessageListener.Dispose();
            this.testablePlatformServiceProvider.MockTraceListenerManager.Verify(mtlm => mtlm.Dispose(this.testablePlatformServiceProvider.MockTraceListener.Object), Times.Once);
        }
Ejemplo n.º 3
0
        public void DisposeShouldRemoveTraceListenerIfDebugTracesIsEnabled()
        {
            using (var logMessageListener = new LogMessageListener(true))
            {
                logMessageListener.Dispose();
            }

            // Once when Dispose() is called and second time when destructor is called
            this.testablePlatformServiceProvider.MockTraceListenerManager.Verify(mtlm => mtlm.Remove(It.IsAny <ITraceListener>()), Times.Exactly(1));
        }