예제 #1
0
        public void CanOverrideDefaultClassificationThrow()
        {
            var m = CreateTestMessage(200);

            var options = new RequestOptions();

            options.AddClassifier(new[] { 200 }, ResponseClassification.Throw);

            RequestOptions.Apply(options, m);

            Assert.True(m.ResponseClassifier.IsErrorResponse(m));
        }
예제 #2
0
        public void CanOverrideDefaultClassificationNoRetry()
        {
            var m = CreateTestMessage(500);

            var options = new RequestOptions();

            options.AddClassifier(new[] { 500 }, ResponseClassification.DontRetry);

            RequestOptions.Apply(options, m);

            Assert.False(m.ResponseClassifier.IsRetriableResponse(m));
        }
예제 #3
0
        public void CanOverrideDefaultClassificationSuccess()
        {
            var m = CreateTestMessage(404);

            var options = new RequestOptions();

            options.AddClassifier(new[] { 404 }, ResponseClassification.Success);

            RequestOptions.Apply(options, m);

            Assert.False(m.ResponseClassifier.IsErrorResponse(m));
        }
예제 #4
0
        public void CanOverrideDefaultClassificationWithFunc()
        {
            HttpMessage m = new HttpMessage(new MockRequest(), new ResponseClassifier())
            {
                Response = new MockResponse(500)
            };

            var options = new RequestOptions();

            options.AddClassifier(_ => ResponseClassification.Success);

            RequestOptions.Apply(options, m);

            Assert.False(m.ResponseClassifier.IsErrorResponse(m));
        }