/// <summary>
        /// Adds a sink that writes log events to a table in a MSSqlServer database.
        /// </summary>
        /// <param name="loggerAuditSinkConfiguration">The logger configuration.</param>
        /// <param name="connectionString">The connection string to the database where to store the events.</param>
        /// <param name="sinkOptions">Supplies additional settings for the sink</param>
        /// <param name="sinkOptionsSection">A config section defining additional settings for the sink</param>
        /// <param name="appConfiguration">Additional application-level configuration. Required if connectionString is a name.</param>
        /// <param name="restrictedToMinimumLevel">The minimum log event level required in order to write an event to the sink.</param>
        /// <param name="formatProvider">Supplies culture-specific formatting information, or null.</param>
        /// <param name="columnOptions">An externally-modified group of column settings</param>
        /// <param name="columnOptionsSection">A config section defining various column settings</param>
        /// <param name="logEventFormatter">Supplies custom formatter for the LogEvent column, or null</param>
        /// <returns>Logger configuration, allowing configuration to continue.</returns>
        /// <exception cref="ArgumentNullException">A required parameter is null.</exception>
        public static LoggerConfiguration MSSqlServer(
            this LoggerAuditSinkConfiguration loggerAuditSinkConfiguration,
            string connectionString,
            MSSqlServerSinkOptions sinkOptions       = null,
            IConfigurationSection sinkOptionsSection = null,
            IConfiguration appConfiguration          = null,
            LogEventLevel restrictedToMinimumLevel   = LevelAlias.Minimum,
            IFormatProvider formatProvider           = null,
            ColumnOptions columnOptions = null,
            IConfigurationSection columnOptionsSection = null,
            ITextFormatter logEventFormatter           = null)
        {
            if (loggerAuditSinkConfiguration == null)
            {
                throw new ArgumentNullException(nameof(loggerAuditSinkConfiguration));
            }

            ReadConfiguration(ref connectionString, ref sinkOptions, appConfiguration, ref columnOptions,
                              columnOptionsSection, sinkOptionsSection);

            IMSSqlServerAuditSinkFactory auditSinkFactory = new MSSqlServerAuditSinkFactory();
            var auditSink = auditSinkFactory.Create(connectionString, sinkOptions, formatProvider, columnOptions, logEventFormatter);

            return(loggerAuditSinkConfiguration.Sink(auditSink, restrictedToMinimumLevel));
        }
        public void MSSqlServerAuditSinkFactoryCreateReturnsInstance()
        {
            // Arrange
            var sinkOptions = new MSSqlServerSinkOptions {
                TableName = "TestTableName"
            };
            var sut = new MSSqlServerAuditSinkFactory();

            // Act
            var result = sut.Create(DatabaseFixture.LogEventsConnectionString, sinkOptions, null, new MSSqlServer.ColumnOptions(), null);

            // Assert
            Assert.IsType <MSSqlServerAuditSink>(result);
        }