예제 #1
0
        public void DatabaseLogger_LogAll()
        {
            // Arrange
            logRepository.Setup(l => l.Create(It.IsAny <LogEntry>()))
            .Returns(1234);
            logService.Setup(l => l.ShouldLog(It.IsAny <int>(), It.IsAny <IList <string> >()))
            .Returns(true);
            agentService.SetupGet(s => s.AgentID).Returns(10);

            // Act
            logger.LogCritical("", "");
            logger.LogCritical("", new List <string>());
            logger.LogError("", "");
            logger.LogError("", new Exception(), "");
            logger.LogError("", new List <string>());
            logger.LogInformation("", "");
            logger.LogInformation("", new List <string>());
            logger.LogVerbose("", "");
            logger.LogVerbose("", new List <string>());
            logger.LogWarning("", "");
            logger.LogWarning("", new List <string>());

            // Assert
            logRepository.Verify(l => l.Create(It.IsAny <LogEntry>()), Times.Exactly(11));
        }