예제 #1
0
        public void ShouldNotInsertLogToDatabase()
        {
            //Arrange
            var logToFile            = false;
            var logToConsole         = false;
            var logToDatabase        = true;
            var expectedRowsAffected = 0;

            //Act
            SQLServerLogger sqlServerLogger = new SQLServerLogger();
            var             command         = $"INSERT INTO LOG VALUES('{Constants.TestingMessageLog}', {LogType.Message})";
            var             rowsAffected    = sqlServerLogger.WriteLogInDatabase(command);

            //Assert
            Assert.AreEqual(expectedRowsAffected, rowsAffected);
        }
예제 #2
0
        private void LogToDatabase(string message, LogType logType)
        {
            var command = $"INSERT INTO LOG VALUES('{message}', {logType})";

            sqlServerLogger.WriteLogInDatabase(command);
        }