Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AirbrakeClient"/> class.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        public AirbrakeClient(AirbrakeConfiguration configuration)
        {
            if (configuration == null)
                throw new ArgumentNullException("configuration");

            this.configuration = configuration;
            this.builder = new AirbrakeNoticeBuilder(configuration);
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AirbrakeClient"/> class.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        public AirbrakeClient(AirbrakeConfiguration configuration)
        {
            if (configuration == null)
                throw new ArgumentNullException("configuration");

            this.configuration = configuration;
            this.builder = new AirbrakeNoticeBuilder(configuration);
            //this.log = LogManager.GetLogger(GetType());
        }
Пример #3
0
 public void SetUp()
 {
     this.config = new AirbrakeConfiguration
     {
         ApiKey = "123456",
         EnvironmentName = "test"
     };
     this.builder = new AirbrakeNoticeBuilder(this.config);
 }
Пример #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AirbrakeClient"/> class.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        public AirbrakeClient(AirbrakeConfiguration configuration)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }

            this.configuration = configuration;
            this.builder       = new AirbrakeNoticeBuilder(configuration);
        }
Пример #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AirbrakeClient"/> class.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        public AirbrakeClient(AirbrakeConfiguration configuration)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }

            this.configuration = configuration;
            this.builder       = new AirbrakeNoticeBuilder(configuration);
            this.log           = LogManager.GetLogger(GetType());
        }
Пример #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AirbrakeClient"/> class.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        /// <param name="backtraceBuilder"> </param>
        public AirbrakeClient(AirbrakeConfiguration configuration, IBuilder<Exception, Backtrace> backtraceBuilder = null)
        {
            if (configuration == null)
                throw new ArgumentNullException("configuration");

            this.configuration = configuration;

            if (backtraceBuilder == null)
                backtraceBuilder = new BacktraceBuilder(LogManager.GetLogger<BacktraceBuilder>());
            this.builder = new AirbrakeNoticeBuilder(configuration,backtraceBuilder);

            this.log = LogManager.GetLogger(GetType());
        }
Пример #7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AirbrakeClient"/> class.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        /// <param name="backtraceBuilder"> </param>
        public AirbrakeClient(AirbrakeConfiguration configuration, IBuilder <Exception, Backtrace> backtraceBuilder = null)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }

            this.configuration = configuration;

            if (backtraceBuilder == null)
            {
                backtraceBuilder = new BacktraceBuilder(LogManager.GetLogger <BacktraceBuilder>());
            }
            this.builder = new AirbrakeNoticeBuilder(configuration, backtraceBuilder);

            this.log = LogManager.GetLogger(GetType());
        }
Пример #8
0
        public void Send_EndRequestEventIsInvoked_And_ResponseOnlyContainsApiError()
        {
            bool requestEndInvoked = false;
             AirbrakeResponseError[] errors = null;
             int i = 0;

             this.client.RequestEnd += (sender, e) =>
             {
            requestEndInvoked = true;
            errors = e.Response.Errors;
             };

             var configuration = new AirbrakeConfiguration
             {
            ApiKey = Guid.NewGuid().ToString("N"),
            EnvironmentName = "test",
             };

             var builder = new AirbrakeNoticeBuilder(configuration);

             AirbrakeNotice notice = builder.Notice(new Exception("Test"));

             notice.Request = new AirbrakeRequest("http://example.com", "Test")
             {
            Params = new[]
            {
               new AirbrakeVar("TestKey", "TestValue")
            }
             };

             this.client.Send(notice);

             while (!requestEndInvoked)
             {
            // Sleep for maximum 5 seconds to wait for the request to end. Can probably be done more elegantly.
            if (i++ == 50)
               break;

            Thread.Sleep(100);
             }

             Assert.That(requestEndInvoked, Is.True);
             Assert.That(errors, Is.Not.Null);
             Assert.That(errors, Has.Length.EqualTo(1));
        }
Пример #9
0
 public SharpbrakeClient(AirbrakeClient client, AirbrakeNoticeBuilder builder)
 {
   this.Client = new AirbrakeClient();
   this.Builder = new AirbrakeNoticeBuilder();
 }
Пример #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AirbrakeClient"/> class.
 /// </summary>
 public AirbrakeClient()
 {
     this.builder = new AirbrakeNoticeBuilder();
     this.log = LogManager.GetLogger(GetType());
 }
Пример #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AirbrakeClient"/> class.
 /// </summary>
 public AirbrakeClient()
 {
     this.builder = new AirbrakeNoticeBuilder();
     this.log     = LogManager.GetLogger(GetType());
 }