Пример #1
0
        public void NoFailedEventMessageWillBeLogIntoConsoleWhenCallLogFailedEventDetailsWithEmptyFailedEventListAndZeroTotalFailed()
        {
            //Arrange
            var mockLogWriter   = new Mock <ILogWriter>();
            var logger          = new FlightEventLogger(mockLogWriter.Object);
            var failedEventList = new List <string>();
            var totalFailed     = 0;

            //Act
            logger.LogFailedEventDetails(failedEventList, totalFailed);

            //Assert
            mockLogWriter.Verify(l => l.WriteInfoToConsole("There is no failed event"), Times.Once);
        }
Пример #2
0
        public void FailedEventDetailsWillBeLogIntoConsoleWhenCallLogFailedEventDetailsWithCorrectParamters()
        {
            //Arrange
            var failedEventList = new List <string> {
                "test", "failed"
            };
            var totalFailed   = failedEventList.Count;
            var mockLogWriter = new Mock <ILogWriter>();
            var logger        = new FlightEventLogger(mockLogWriter.Object);

            //Act
            logger.LogFailedEventDetails(failedEventList, totalFailed);

            //Assert
            mockLogWriter.Verify(l => l.WriteInfoToConsole($"Total Failed number is {totalFailed}"), Times.Once);
            mockLogWriter.Verify(l => l.WriteInfoToConsole("Failed events have been listed below"), Times.Once);
            mockLogWriter.Verify(l => l.WriteInfoToConsole(failedEventList[0]), Times.Once);
        }