コード例 #1
0
        public void CollectorLogger_DoesNotCollectNonError()
        {
            // Arrange
            var innerLogger = new Mock <ILogger>();
            var collector   = new CollectorLogger(innerLogger.Object);

            // Act
            collector.LogDebug("Debug");
            collector.LogVerbose("Verbose");
            collector.LogInformation("Information");
            collector.LogWarning("Warning");
            var errors = collector.Errors.ToArray();

            // Assert
            Assert.Empty(errors);
        }
コード例 #2
0
        public void CollectorLogger_PassesToInnerLogger()
        {
            // Arrange
            var innerLogger = new Mock <ILogger>();
            var collector   = new CollectorLogger(innerLogger.Object);

            // Act
            collector.LogDebug("Debug");
            collector.LogVerbose("Verbose");
            collector.LogInformation("Information");
            collector.LogWarning("Warning");
            collector.LogError("Error");

            // Assert
            innerLogger.Verify(x => x.LogDebug("Debug"), Times.Once);
            innerLogger.Verify(x => x.LogVerbose("Verbose"), Times.Once);
            innerLogger.Verify(x => x.LogInformation("Information"), Times.Once);
            innerLogger.Verify(x => x.LogWarning("Warning"), Times.Once);
            innerLogger.Verify(x => x.LogError("Error"), Times.Once);
        }