コード例 #1
0
 public RollbarResponse SendPayload(RollbarPayload payload) {
     using (var client = new WebClient()) {
         client.Headers[HttpRequestHeader.ContentType] = ContentType;
         try {
             return new RollbarResponse {
                 Message = client.UploadString(new Uri(RollbarApiEndpoint), "POST", payload.ToJson()),
                 StatusCode = RollbarResponseCode.Success,
             };
         }
         catch (WebException exception) {
             return new RollbarResponse {
                 Message = exception.Message,
                 StatusCode = ToRollbarStatus(exception.Status),
             };
         }
     }
 }
コード例 #2
0
 public void RollbarPayload_cannot_have_null_data() {
     Assert.Throws<ArgumentNullException>(() => {
         var x = new RollbarPayload("test", null);
     });
 }
コード例 #3
0
 public void RollbarPayload_cannot_have_null_access_token() {
     Assert.Throws<ArgumentNullException>(() => {
         var x = new RollbarPayload(null, A<RollbarData>.Ignored);
     });
 }
コード例 #4
0
 public RollbarPayloadFixture() {
     this._exceptionExample = new RollbarPayload("access-token", new RollbarData("test", new RollbarBody(GetException())));
     this._messageException = new RollbarPayload("access-token", new RollbarData("test", new RollbarBody(new RollbarMessage("A message I wish to send to the rollbar overlords"))));
     this._crashException = new RollbarPayload("access-token", new RollbarData("test", new RollbarBody("A terrible crash!")));
     this._aggregateExample = new RollbarPayload("access-token", new RollbarData("test", new RollbarBody(GetAggregateException())));
 }