コード例 #1
0
        public void Can_Handle_Exception_from_AlwaysThrowsList_with_GET_route()
        {
            var client = CreateNewServiceClient();

            if (client is WcfServiceClient)
            {
                return;
            }
            try
            {
                var response = client.Get <List <AlwaysThrows> >("/throwslist/404/{0}".Fmt(TestString));

                Assert.Fail("Should throw HTTP errors");
            }
            catch (WebServiceException webEx)
            {
                Assert.That(webEx.StatusCode, Is.EqualTo(404));

                var response      = (ErrorResponse)webEx.ResponseDto;
                var expectedError = AlwaysThrowsService.GetErrorMessage(TestString);
                Assert.That(response.ResponseStatus.ErrorCode,
                            Is.EqualTo(typeof(NotImplementedException).Name));
                Assert.That(response.ResponseStatus.Message,
                            Is.EqualTo(expectedError));
            }
        }
コード例 #2
0
		public void Can_Handle_Exception_from_AlwaysThrowService()
		{
			string result;
			var responseStatus = client.AlwaysThrows(out result, TestString);

			var expectedError = AlwaysThrowsService.GetErrorMessage(TestString);
			Assert.That(responseStatus.ErrorCode,
				Is.EqualTo(typeof(NotImplementedException).Name));
			Assert.That(responseStatus.Message, Is.EqualTo(expectedError));
		}
コード例 #3
0
        public void Can_Handle_Exception_from_AlwaysThrowService()
        {
            var client   = CreateNewServiceClient();
            var response = client.Send <AlwaysThrowsResponse>(
                new AlwaysThrows {
                Value = TestString
            });

            var expectedError = AlwaysThrowsService.GetErrorMessage(TestString);

            Assert.That(response.ResponseStatus.ErrorCode,
                        Is.EqualTo(typeof(NotImplementedException).Name));
            Assert.That(response.ResponseStatus.Message,
                        Is.EqualTo(expectedError));
        }
コード例 #4
0
        public void Can_Handle_Exception_from_AlwaysThrowService()
        {
            var client = CreateNewServiceClient();

            try
            {
                var response = client.Send <AlwaysThrowsResponse>(
                    new AlwaysThrows {
                    Value = TestString
                });

                Assert.Fail("Should throw HTTP errors");
            }
            catch (WebServiceException webEx)
            {
                var response      = (AlwaysThrowsResponse)webEx.ResponseDto;
                var expectedError = AlwaysThrowsService.GetErrorMessage(TestString);
                Assert.That(response.ResponseStatus.ErrorCode,
                            Is.EqualTo(typeof(NotImplementedException).Name));
                Assert.That(response.ResponseStatus.Message,
                            Is.EqualTo(expectedError));
            }
        }