Пример #1
0
        public void Exception_ResponseMessageConstructor()
        {
            var response = new RiotResponse(null);
            var message  = "TEST";

            var ex1 = new RestException(response, message);

            Assert.That(ex1.Response, Is.EqualTo(response));
            Assert.That(ex1.Message, Is.EqualTo(message));

            var ex2 = new NotFoundException(response, message);

            Assert.That(ex2.Response, Is.EqualTo(response));
            Assert.That(ex2.Message, Is.EqualTo(message));

            var ex3 = new RateLimitExceededException(response, message);

            Assert.That(ex3.Response, Is.EqualTo(response));
            Assert.That(ex3.Message, Is.EqualTo(message));

            var ex4 = new RestTimeoutException(response, message);

            Assert.That(ex4.Response, Is.EqualTo(response));
            Assert.That(ex4.Message, Is.EqualTo(message));

            var ex5 = new ConnectionFailedException(response, message);

            Assert.That(ex5.Response, Is.EqualTo(response));
            Assert.That(ex5.Message, Is.EqualTo(message));
        }
Пример #2
0
        public void Exception_ResponseConstructor()
        {
            var response = new RiotResponse(new HttpResponseMessage(System.Net.HttpStatusCode.OK));

            var ex1 = new RestException(response);

            Assert.That(ex1.Response, Is.EqualTo(response));

            var ex2 = new NotFoundException(response);

            Assert.That(ex2.Response, Is.EqualTo(response));

            var ex3 = new RateLimitExceededException(response);

            Assert.That(ex3.Response, Is.EqualTo(response));

            var ex4 = new RestTimeoutException(response);

            Assert.That(ex4.Response, Is.EqualTo(response));

            var ex5 = new ConnectionFailedException(response);

            Assert.That(ex5.Response, Is.EqualTo(response));
        }
Пример #3
0
        public void Exception_ResponseConstructor_NullHttpResponse()
        {
            var response = new RiotResponse(null);

            var ex1 = new RestException(response);

            Assert.That(ex1.Response, Is.EqualTo(response));

            var ex2 = new NotFoundException(response);

            Assert.That(ex2.Response, Is.EqualTo(response));

            var ex3 = new RateLimitExceededException(response);

            Assert.That(ex3.Response, Is.EqualTo(response));

            var ex4 = new RestTimeoutException(response);

            Assert.That(ex4.Response, Is.EqualTo(response));

            var ex5 = new ConnectionFailedException(response);

            Assert.That(ex5.Response, Is.EqualTo(response));
        }
Пример #4
0
 /// <summary>
 /// Creates a new <see cref="RetryEventArgs"/> instance.
 /// </summary>
 /// <param name="response">The response for the request that caused the event.</param>
 /// <param name="attemptCount">The number of times that the same request has been attempted.</param>
 public RetryEventArgs(RiotResponse response, int attemptCount)
     : base(response)
 {
     this.attemptCount = attemptCount;
 }
Пример #5
0
 /// <summary>
 /// Creates a new <see cref="RetryEventArgs"/> instance.
 /// </summary>
 /// <param name="response">The response for the request that caused the event.</param>
 /// <param name="attemptCount">The number of times that the same request has been attempted.</param>
 public RetryEventArgs(RiotResponse response, int attemptCount)
     : base(response)
 {
     this.attemptCount = attemptCount;
 }