public void ExceptionFilterTest_BusinessError_Encrypted()
        {
            using (var server = new EncryptedHttpRouteWrapper())
            using (HttpClient client = new EncryptedHttpClientWrapper())
            {
                var exceptionFilter = new ExceptionFilter();
                exceptionFilter.Exception += (sender, e) =>
                {
                    e.Handled = true;
                    e.ReturnCode = "7533967";
                    e.Message = "中毒太深";
                };
                server.Configuration.Filters.Add(exceptionFilter);

                try
                {
                    client.PostJson<object, object>(
                        "/api2/ApiServerTest/BusinessErrorTest",
                        null,
                        null
                    );

                    Assert.Fail("Did not throw expected exception InvocationNotAcceptableException.");
                }
                catch (InvocationNotAcceptableException ex)
                {
                    Assert.AreEqual("中毒太深", ex.Message);
                    Assert.AreEqual("7533967", ex.ErrorCode);
                }
            }
        }
        public void ExceptionFilterTest_ProgramError_Encrypted()
        {
            using (var server = new EncryptedHttpRouteWrapper())
            using (HttpClient client = new EncryptedHttpClientWrapper())
            {
                server.Configuration.Filters.Add(new ExceptionFilter());

                try
                {
                    client.PostJson<object, object>(
                        "/api2/ApiServerTest/ProgramErrorTest",
                        null,
                        null
                    );

                    Assert.Fail("Did not throw expected exception HttpServiceException.");
                }
                catch (HttpServiceException ex)
                {
                    Assert.AreEqual("模擬非商業邏輯錯誤。", ex.ExceptionMessage);
                    Assert.AreEqual(typeof(InvalidOperationException).FullName, ex.ExceptionType);
                }
            }
        }