/// <summary>
 /// Initializes a new instance of the <see cref="SumoLogicMessageSenderTest"/> class.
 /// </summary>
 public SumoLogicMessageSenderTest()
 {
     this.messagesHandler = new MockHttpMessageHandler();
     this.sumoLogicMessageSender = new SumoLogicMessageSender(this.messagesHandler, null);
     this.sumoLogicMessageSender.Url = new Uri("http://www.fakeadress.com");
     this.sumoLogicMessageSender.RetryInterval = TimeSpan.FromSeconds(30);
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="SumoLogicAppenderTest"/> class.
        /// </summary>
        public SumoLogicAppenderTest()
        {
            this.messagesHandler = new MockHttpMessageHandler();

            this.sumoLogicAppender = new SumoLogicAppender(null, this.messagesHandler);
            this.sumoLogicAppender.Url = "http://www.fakeadress.com";
            this.sumoLogicAppender.Layout = new PatternLayout("-- %m%n");
            this.sumoLogicAppender.ActivateOptions();

            this.log4netLog = LogManager.GetLogger(typeof(SumoLogicAppenderTest));
            this.log4netLogger = this.log4netLog.Logger as Logger;
            this.log4netLogger.Additivity = false;
            this.log4netLogger.Level = Level.All;
            this.log4netLogger.RemoveAllAppenders();
            this.log4netLogger.AddAppender(this.sumoLogicAppender);
            this.log4netLogger.Repository.Configured = true;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SumoLogicTargetTest"/> class.
        /// </summary>
        public SumoLogicTargetTest()
        {
            this.messagesHandler = new MockHttpMessageHandler();
            this.sumoLogicTarget = new SumoLogicTarget(null, this.messagesHandler);
            this.sumoLogicTarget.Url = "http://www.fakeadress.com";
            this.sumoLogicTarget.Layout = @"${level:upperCase=true}: ${message}";
            this.sumoLogicTarget.SourceName = "SumoLogicTargetTest";
            this.sumoLogicTarget.Name = "SumoLogicTargetTest";
            if (LogManager.Configuration == null)
            {
                LogManager.Configuration = new LoggingConfiguration();
            }

            LogManager.Configuration.AddTarget(this.sumoLogicTarget.SourceName, this.sumoLogicTarget);
            LoggingRule rule = new LoggingRule("SumoLogicTargetTest", LogLevel.Debug, this.sumoLogicTarget);
            LogManager.Configuration.LoggingRules.Add(rule);
            LogManager.Configuration.Reload();
            LogManager.ReconfigExistingLoggers();
            this.logger = LogManager.GetLogger("SumoLogicTargetTest");
        }
        /// <summary>
        /// Setups the logger with the <see cref="BufferedSumoLogicTarget"/> based on the given settings.
        /// </summary>
        /// <param name="messagesPerRequest">The maximum messages per request.</param>
        /// <param name="maxFlushInterval">The maximum flush interval, in milliseconds.</param>
        /// <param name="flushingAccuracy">The flushing accuracy, in milliseconds.</param>
        /// <param name="retryInterval">The retry interval, in milliseconds.</param>
        private void SetUpLogger(long messagesPerRequest, long maxFlushInterval, long flushingAccuracy, long retryInterval = 10000)
        {
            this.messagesHandler = new MockHttpMessageHandler();
            this.bufferedSumoLogicTarget = new BufferedSumoLogicTarget(null, this.messagesHandler);
            this.bufferedSumoLogicTarget.Url = "http://www.fakeadress.com";
            this.bufferedSumoLogicTarget.Layout = @"${level:upperCase=true}: ${message}";
            this.bufferedSumoLogicTarget.SourceName = "BufferedSumoLogicTargetTest";
            this.bufferedSumoLogicTarget.SourceName = "BufferedSumoLogicTargetTest";
            this.bufferedSumoLogicTarget.MessagesPerRequest = messagesPerRequest;
            this.bufferedSumoLogicTarget.MaxFlushInterval = maxFlushInterval;
            this.bufferedSumoLogicTarget.FlushingAccuracy = flushingAccuracy;
            this.bufferedSumoLogicTarget.RetryInterval = retryInterval;
            if (LogManager.Configuration == null)
            {
                LogManager.Configuration = new LoggingConfiguration();
            }

            LogManager.Configuration.AddTarget(this.bufferedSumoLogicTarget.SourceName, this.bufferedSumoLogicTarget);
            LoggingRule rule = new LoggingRule("BufferedSumoLogicTargetTest", LogLevel.Info, this.bufferedSumoLogicTarget);
            LogManager.Configuration.LoggingRules.Add(rule);
            LogManager.Configuration.Reload();
            LogManager.ReconfigExistingLoggers();
            this.logger = LogManager.GetLogger("BufferedSumoLogicTargetTest");
        }
        /// <summary>
        /// Setups the logger with the <see cref="BufferedSumoLogicAppender"/> based on the given settings.
        /// </summary>
        /// <param name="messagesPerRequest">The maximum messages per request.</param>
        /// <param name="maxFlushInterval">The maximum flush interval, in milliseconds.</param>
        /// <param name="flushingAccuracy">The flushing accuracy, in milliseconds.</param>
        /// <param name="retryInterval">The retry interval, in milliseconds.</param>
        private void SetUpLogger(long messagesPerRequest, long maxFlushInterval, long flushingAccuracy, long retryInterval = 10000)
        {
            this.messagesHandler = new MockHttpMessageHandler();

            this.bufferedSumoLogicAppender = new BufferedSumoLogicAppender(null, this.messagesHandler);
            this.bufferedSumoLogicAppender.Url = "http://www.fakeadress.com";
            this.bufferedSumoLogicAppender.MessagesPerRequest = messagesPerRequest;
            this.bufferedSumoLogicAppender.MaxFlushInterval = maxFlushInterval;
            this.bufferedSumoLogicAppender.FlushingAccuracy = flushingAccuracy;
            this.bufferedSumoLogicAppender.RetryInterval = retryInterval;
            this.bufferedSumoLogicAppender.Layout = new PatternLayout("%m%n");
            this.bufferedSumoLogicAppender.ActivateOptions();

            this.log4netLog = LogManager.GetLogger(typeof(BufferedSumoLogicAppenderTest));
            this.log4netLogger = this.log4netLog.Logger as Logger;
            this.log4netLogger.Additivity = false;
            this.log4netLogger.Level = Level.All;
            this.log4netLogger.RemoveAllAppenders();
            this.log4netLogger.AddAppender(this.bufferedSumoLogicAppender);
            this.log4netLogger.Repository.Configured = true;
        }