示例#1
0
        public void TestSendSingleMessage()
        {
            Keyword keyword = new Keyword
            {
                Color = "#85be53",
                Value = "HU7142"
            };
            Context context = new Context
            {
                HeadColor  = "#85be53",
                Url        = "https://docs.open.alipay.com/api_6/alipay.open.public.message.single.send",
                ActionName = "查看详情",
                Keyword1   = keyword,
                Keyword2   = keyword,
                First      = keyword,
                Remark     = keyword
            };

            Alipay.EasySDK.Marketing.OpenLife.Models.Template template = new Alipay.EasySDK.Marketing.OpenLife.Models.Template
            {
                TemplateId = "e44cd3e52ffa46b1a50afc145f55d1ea",
                Context    = context
            };
            AlipayOpenPublicMessageSingleSendResponse response = Factory.Marketing.OpenLife().SendSingleMessage(
                "2088002656718920", template);

            Assert.IsTrue(ResponseChecker.Success(response));
            Assert.AreEqual(response.Code, "10000");
            Assert.AreEqual(response.Msg, "Success");
            Assert.IsNull(response.SubCode);
            Assert.IsNull(response.SubMsg);
            Assert.NotNull(response.HttpBody);
        }
        private void NegotiateWithNegotiateContexts(
            DialectRevision clientMaxDialectSupported,
            PreauthIntegrityHashID[] preauthHashAlgs,
            EncryptionAlgorithm[] encryptionAlgs         = null,
            ResponseChecker <NEGOTIATE_Response> checker = null)
        {
            // ensure clientMaxDialectSupported higher than 3.11
            if (clientMaxDialectSupported < DialectRevision.Smb311)
            {
                clientMaxDialectSupported = DialectRevision.Smb311;
            }
            DialectRevision[] negotiateDialects = Smb2Utility.GetDialects(clientMaxDialectSupported);

            if (clientMaxDialectSupported > TestConfig.MaxSmbVersionClientSupported)
            {
                BaseTestSite.Assert.Inconclusive("Stop to run this test case because the configured MaxSmbVersionClientSupported {0} is lower than {1}.",
                                                 TestConfig.MaxSmbVersionClientSupported,
                                                 clientMaxDialectSupported);
            }

            status = client.NegotiateWithContexts(
                Packet_Header_Flags_Values.NONE,
                negotiateDialects,
                preauthHashAlgs: preauthHashAlgs,
                encryptionAlgs: encryptionAlgs,
                checker: checker);
        }
示例#3
0
        public void TestSendImageText()
        {
            Article article = new Article
            {
                ActionName = "测试",
                Desc       = "测试",
                Title      = "测试",
                ImageUrl   = "http://dl.django.t.taobao.com/rest/1.0/image?fileIds=hOTQ1lT1TtOjcxGflvnUXgAAACMAAQED",
                Url        = "https://docs.open.alipay.com/api_6/alipay.open.public.message.total.send"
            };
            AlipayOpenPublicMessageTotalSendResponse response = Factory.Marketing.OpenLife().SendImageText(new List <Article> {
                article
            });

            if (response.Code.Equals("10000"))
            {
                Assert.IsTrue(ResponseChecker.Success(response));
                Assert.AreEqual(response.Code, "10000");
                Assert.AreEqual(response.Msg, "Success");
                Assert.Null(response.SubCode);
                Assert.Null(response.SubMsg);
                Assert.NotNull(response.HttpBody);
                Assert.NotNull(response.MessageId);
            }
            else
            {
                Assert.IsFalse(ResponseChecker.Success(response));
                Assert.AreEqual(response.Code, "40004");
                Assert.AreEqual(response.Msg, "Business Failed");
                Assert.AreEqual(response.SubCode, "PUB.MSG_BATCH_SD_OVER");
                Assert.AreEqual(response.SubMsg, "批量发送消息频率超限");
                Assert.NotNull(response.HttpBody);
                Assert.Null(response.MessageId);
            }
        }
示例#4
0
        public void TestSendText()
        {
            AlipayOpenPublicMessageTotalSendResponse response = Factory.Marketing.OpenLife().SendText("测试");

            if (response.Code.Equals("10000"))
            {
                Assert.IsTrue(ResponseChecker.Success(response));
                Assert.AreEqual(response.Code, "10000");
                Assert.AreEqual(response.Msg, "Success");
                Assert.Null(response.SubCode);
                Assert.Null(response.SubMsg);
                Assert.NotNull(response.HttpBody);
                Assert.NotNull(response.MessageId);
            }
            else
            {
                Assert.IsFalse(ResponseChecker.Success(response));
                Assert.AreEqual(response.Code, "40004");
                Assert.AreEqual(response.Msg, "Business Failed");
                Assert.AreEqual(response.SubCode, "PUB.MSG_BATCH_SD_OVER");
                Assert.AreEqual(response.SubMsg, "批量发送消息频率超限");
                Assert.NotNull(response.HttpBody);
                Assert.Null(response.MessageId);
            }
        }
        private void OpenFile(
            Smb2FunctionalClient client,
            Guid clientGuid,
            string fileName,
            bool isPersistentHandle,
            out Guid createGuid,
            out uint treeId,
            out FILEID fileId,
            ResponseChecker <CREATE_Response> responseChecker = null)
        {
            // connect to share
            ConnectToShare(
                client,
                clientGuid,
                out treeId);
            BaseTestSite.Log.Add(
                LogEntryKind.Debug,
                "Connect to share '{0}' on scaleout server '{1}'", testConfig.BasicFileShare, testConfig.SutComputerName);

            #region Construct Create Context
            List <Smb2CreateContextRequest> createContextList = new List <Smb2CreateContextRequest>();
            createGuid = Guid.Empty;
            if (isPersistentHandle)
            {
                // durable handle request context
                createGuid = Guid.NewGuid();
                createContextList.Add(new Smb2CreateDurableHandleRequestV2()
                {
                    CreateGuid = createGuid,
                    Flags      = CREATE_DURABLE_HANDLE_REQUEST_V2_Flags.DHANDLE_FLAG_PERSISTENT,
                    Timeout    = 0      // default
                });
            }
            #endregion

            // open file
            BaseTestSite.Log.Add(
                LogEntryKind.Debug,
                "Create Open with file name '{0}'", fileName);

            Smb2CreateContextResponse[] createContextResponses;
            client.Create(
                treeId,
                fileName,
                CreateOptions_Values.FILE_NON_DIRECTORY_FILE,
                out fileId,
                out createContextResponses,
                createContexts: createContextList.ToArray <Smb2CreateContextRequest>(),
                checker: responseChecker
                );

            #region check whether Persistent Handle is created successfully with current status
            if (isPersistentHandle)
            {
                BaseTestSite.Assert.IsTrue(
                    CheckDurableCreateContextResponse(createContextResponses),
                    "Create Response should contain Smb2CreateDurableHandleResponseV2.");
            }
            #endregion
        }
示例#6
0
        public void TestPayWithOptional()
        {
            Dictionary <string, object> optionalArgs = new Dictionary <string, object>
            {
                { "timeout_express", "10m" },
                { "body", "iPhone6 16G" }
            };
            AlipayTradeWapPayResponse response = Factory.Payment.Wap()
                                                 .Agent("ca34ea491e7146cc87d25fca24c4cD11").BatchOptional(optionalArgs)
                                                 .Pay("iPhone6 16G", "b7f4bc7d-ea4b-4efd-9072-d8ea913c8946", "0.10",
                                                      "https://www.taobao.com", "https://www.taobao.com");

            Assert.IsTrue(ResponseChecker.Success(response));
            Assert.IsTrue(response.Body.Contains("<form name=\"punchout_form\" method=\"post\" "
                                                 + "action=\"https://openapi.alipay.com/gateway.do?"));
            Assert.IsTrue(response.Body.Contains("notify_url"));
            Assert.IsTrue(response.Body.Contains("return_url"));
            Assert.IsTrue(response.Body.Contains("app_auth_token"));
            Assert.IsTrue(response.Body.Contains("timeout_express"));
            Assert.IsTrue(response.Body.Contains("body"));
            Assert.IsTrue(response.Body.Contains("<input type=\"hidden\" name=\"biz_content\" value=\"{&quot;subject&quot;:&quot;iPhone6 16G&quot;,&quot;out_trade_no&quot;:&quot;"
                                                 + "b7f4bc7d-ea4b-4efd-9072-d8ea913c8946&quot;,&quot;total_amount&quot;:&quot;0.10&quot;,&quot;quit_url&quot;:&quot;"
                                                 + "https://www.taobao.com&quot;,&quot;product_code&quot;:&quot;QUICK_WAP_WAY&quot;,&quot;timeout_express&quot;:&quot;"
                                                 + "10m&quot;,&quot;body&quot;:&quot;iPhone6 16G&quot;}\">"));
            Assert.IsTrue(response.Body.Contains("<input type=\"submit\" value=\"立即支付\" style=\"display:none\" >"));
            Assert.IsTrue(response.Body.Contains("<script>document.forms[0].submit();</script>"));
        }
示例#7
0
        public void TestInit()
        {
            IdentityParam identityParam = new IdentityParam()
            {
                IdentityType = "CERT_INFO",
                CertType     = "IDENTITY_CARD",
                CertName     = "张三",
                CertNo       = "513901198008089876"
            };

            MerchantConfig merchantConfig = new MerchantConfig()
            {
                ReturnUrl = "www.taobao.com"
            };


            AlipayUserCertifyOpenInitializeResponse response = Factory.Member.Identification().Init(
                Guid.NewGuid().ToString(), "FACE", identityParam, merchantConfig);

            Assert.IsTrue(ResponseChecker.Success(response));
            Assert.AreEqual(response.Code, "10000");
            Assert.AreEqual(response.Msg, "Success");
            Assert.IsNull(response.SubCode);
            Assert.IsNull(response.SubMsg);
            Assert.NotNull(response.HttpBody);
            Assert.NotNull(response.CertifyId);
        }
        public uint TreeConnect(
            string uncSharePath,
            out uint treeId,
            ResponseChecker <TREE_CONNECT_Response> checker = null,
            ushort creditRequest = 1)
        {
            Packet_Header         header;
            TREE_CONNECT_Response treeConnectResponse;

            uint status = client.TreeConnect(
                1,
                creditRequest,
                Packet_Header_Flags_Values.NONE,
                messageId++,
                sessionId,
                uncSharePath,
                out treeId,
                out header,
                out treeConnectResponse);

            InnerResponseChecker(checker, header, treeConnectResponse);

            grantedCredit = header.CreditRequestResponse;

            return(status);
        }
示例#9
0
        private void btnCheckNow_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                using (var session = SharpArch.NHibernate.NHibernateSession.GetDefaultSessionFactory().OpenSession())
                {
                    using (var transaction = session.BeginTransaction())
                    {
                        SiteRepository          siteRepository          = new SiteRepository(session);
                        SiteResponseRepository  siteResponseRepository  = new SiteResponseRepository(session);
                        SiteErrorRepository     siteErrorRepository     = new SiteErrorRepository(session);
                        NotificationsRepository notificationsRepository = new NotificationsRepository(session);

                        Site         siteToUpdate = ((FrameworkElement)sender).DataContext as Site;
                        int          id           = siteToUpdate.Id;
                        Site         site         = siteRepository.Get(id);
                        SiteResponse lastResponse = siteResponseRepository.GetLastResponse(site.Id);

                        ResponseChecker checker = new ResponseChecker(ApplicationLogic.Utils.Logger.Instance, siteRepository, siteResponseRepository, siteErrorRepository, notificationsRepository);
                        checker.CheckResponse(site, lastResponse);
                        transaction.Commit();
                    }
                }
            }
            catch (Exception ex)
            {
                ApplicationLogic.Utils.Logger.Instance.LogError(ex);
            }

            UpdateDataGrid();
        }
示例#10
0
        public void TestSetIndustry()
        {
            AlipayOpenPublicTemplateMessageIndustryModifyResponse response = Factory.Marketing.OpenLife().SetIndustry(
                "10001/20102", "IT科技/IT软件与服务",
                "10001/20102", "IT科技/IT软件与服务");

            if (response.Code.Equals("10000"))
            {
                Assert.IsTrue(ResponseChecker.Success(response));
                Assert.AreEqual(response.Code, "10000");
                Assert.AreEqual(response.Msg, "Success");
                Assert.Null(response.SubCode);
                Assert.Null(response.SubMsg);
                Assert.NotNull(response.HttpBody);
            }
            else
            {
                Assert.IsFalse(ResponseChecker.Success(response));
                Assert.AreEqual(response.Code, "40004");
                Assert.AreEqual(response.Msg, "Business Failed");
                Assert.AreEqual(response.SubCode, "3002");
                Assert.AreEqual(response.SubMsg, ("模板消息行业一月只能修改一次"));
                Assert.NotNull(response.HttpBody);
            }
        }
示例#11
0
        public void TestCertify()
        {
            AlipayUserCertifyOpenCertifyResponse response = Factory.Member.Identification().Certify("bbdb57e87211279e2c22de5846d85161");

            Assert.IsTrue(ResponseChecker.Success(response));
            Assert.IsTrue(response.Body.Contains("https://openapi.alipay.com/gateway.do?alipay_sdk=alipay-easysdk-net"));
            Assert.IsTrue(response.Body.Contains("sign"));
        }
示例#12
0
        public void TestPay()
        {
            AlipayTradeAppPayResponse response = Factory.Payment.App().Pay("iPhone6 16G",
                                                                           "f4833085-0c46-4bb0-8e5f-622a02a4cffc", "0.10");

            Assert.IsTrue(ResponseChecker.Success(response));
            Assert.IsTrue(response.Body.Contains("app_id=2019022663440152&biz_content=%7b%22subject%22%3a%22iPhone6+16G%22%2c%22" +
                                                 "out_trade_no%22%3a%22f4833085-0c46-4bb0-8e5f-622a02a4cffc%22%2c%22total_amount%22%3a%220.10%22%7d&charset=UTF-8&" +
                                                 "format=json&method=alipay.trade.app.pay&notify_url=https%3a%2f%2fwww.test.com%2fcallback&sign="));
        }
示例#13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string cookiename = null;
                try
                {
                    //通过存储的账户名cookie,来取出对应的账户名
                    //存进的cookie经过加密是一段字符串,需要进行解密,再取
                    FormsAuthenticationTicket ticke = null;
                    string user = Request.Cookies["user"].Value;
                    ticke        = FormsAuthentication.Decrypt(user);
                    cookiename   = ticke.Name;
                    lblogin.Text = "欢迎您!" + cookiename;
                }
                catch (Exception) {
                    if (cookiename == null)
                    {
                        lblogin.Text = "还没登陆,请登录!";
                    }
                }

                //分类展示
                Repeater1.DataSource = BLL.UserBLL.CategoryList();
                Repeater1.DataBind();

                //产品列表展示
                Repeater2.DataSource = BLL.UserBLL.ProductList();
                Repeater2.DataBind();

                //右上角临时购物车展示
                Repeater3.DataSource = BLL.UserBLL.CartList(cookiename);
                Repeater3.DataBind();


                //统计购物车有多少条购物记录
                num = BLL.UserBLL.CountNum(cookiename);

                //支付完成通过传过来的out_trade_no参数来判断是否支付成功
                if (Request.QueryString["out_trade_no"] != null)
                {
                    //通过调用支付宝的API来进行校验查询返回结果
                    AlipayTradeQueryResponse response = Factory.Payment.Common().Query(Request.QueryString["out_trade_no"]);
                    if (ResponseChecker.Success(response))
                    {
                        if (response.TradeStatus.Equals("TRADE_SUCCESS"))
                        {
                            //支付成功清空购物车
                            BLL.UserBLL.UpdateState(response.OutTradeNo);
                        }
                    }
                }
            }
        }
示例#14
0
        public void TestClose()
        {
            AlipayTradeCloseResponse response = Factory.Payment.Common().Close(CreateNewAndReturnOutTradeNo());

            Assert.IsTrue(ResponseChecker.Success(response));
            Assert.AreEqual(response.Code, "10000");
            Assert.AreEqual(response.Msg, "Success");
            Assert.Null(response.SubCode);
            Assert.Null(response.SubMsg);
            Assert.NotNull(response.HttpBody);
        }
示例#15
0
        public void TestRecallMessage()
        {
            AlipayOpenPublicLifeMsgRecallResponse response = Factory.Marketing.OpenLife().RecallMessage("201905106452100327f456f6-8dd2-4a06-8b0e-ec8a3a85c46a");

            Assert.IsTrue(ResponseChecker.Success(response));
            Assert.AreEqual(response.Code, "10000");
            Assert.AreEqual(response.Msg, "Success");
            Assert.IsNull(response.SubCode);
            Assert.IsNull(response.SubMsg);
            Assert.NotNull(response.HttpBody);
        }
示例#16
0
        public void TestRefund()
        {
            AlipayTradeRefundResponse response = Factory.Payment.Common().Refund(CreateNewAndReturnOutTradeNo(), "0.01");

            Assert.IsFalse(ResponseChecker.Success(response));
            Assert.AreEqual(response.Code, "40004");
            Assert.AreEqual(response.Msg, "Business Failed");
            Assert.AreEqual(response.SubCode, "ACQ.TRADE_STATUS_ERROR");
            Assert.AreEqual(response.SubMsg, "交易状态不合法");
            Assert.NotNull(response.HttpBody);
        }
 void InnerResponseChecker <T>(ResponseChecker <T> checker, Packet_Header header, T response)
 {
     if (checker != null)
     {
         checker(header, response);
     }
     else
     {
         TestClassBase.BaseTestSite.Assert.AreEqual(Smb2Status.STATUS_SUCCESS, header.Status, "{0} should succeed", header.Command);
     }
 }
示例#18
0
        public void TestPay()
        {
            AlipayTradePayResponse response = Factory.Payment.FaceToFace().Pay("Iphone6 16G", CreateNewAndReturnOutTradeNo(), "0.01", "1234567890");

            Assert.IsFalse(ResponseChecker.Success(response));
            Assert.AreEqual(response.Code, "40004");
            Assert.AreEqual(response.Msg, "Business Failed");
            Assert.AreEqual(response.SubCode, "ACQ.PAYMENT_AUTH_CODE_INVALID");
            Assert.AreEqual(response.SubMsg, "支付失败,获取顾客账户信息失败,请顾客刷新付款码后重新收款,如再次收款失败,请联系管理员处理。[SOUNDWAVE_PARSER_FAIL]");
            Assert.NotNull(response.HttpBody);
        }
示例#19
0
        public void TestRefreshToken()
        {
            AlipaySystemOauthTokenResponse response = Factory.Base.OAuth().RefreshToken("1234567890");

            Assert.IsFalse(ResponseChecker.Success(response));
            Assert.AreEqual(response.Code, "40002");
            Assert.AreEqual(response.Msg, "Invalid Arguments");
            Assert.AreEqual(response.SubCode, "isv.refresh-token-invalid");
            Assert.AreEqual(response.SubMsg, "刷新令牌refresh_token无效");
            Assert.NotNull(response.HttpBody);
        }
示例#20
0
        public void TestQuery()
        {
            AlipayTradeQueryResponse response = Factory.Payment.Common().Query("6f149ddb-ab8c-4546-81fb-5880b4aaa318");

            Assert.IsTrue(ResponseChecker.Success(response));
            Assert.AreEqual(response.Code, "10000");
            Assert.AreEqual(response.Msg, "Success");
            Assert.Null(response.SubCode);
            Assert.Null(response.SubMsg);
            Assert.NotNull(response.HttpBody);
            Assert.AreEqual(response.OutTradeNo, "6f149ddb-ab8c-4546-81fb-5880b4aaa318");
        }
示例#21
0
        public void TestDownloadBill()
        {
            AlipayDataDataserviceBillDownloadurlQueryResponse response = Factory.Payment.Common().DownloadBill("trade", "2020-01");

            Assert.IsTrue(ResponseChecker.Success(response));
            Assert.AreEqual(response.Code, "10000");
            Assert.AreEqual(response.Msg, "Success");
            Assert.IsNull(response.SubCode);
            Assert.IsNull(response.SubMsg);
            Assert.NotNull(response.HttpBody);
            Assert.IsTrue(response.BillDownloadUrl.StartsWith("http://dwbillcenter.alipay.com/"));
        }
示例#22
0
 private void CheckResponse(Object state)
 {
     try
     {
         ResponseCheckerContext responseCheckContext = (ResponseCheckerContext)state;
         ResponseChecker        checker = new ResponseChecker(Logger, responseCheckContext.SiteRepository, responseCheckContext.SiteResponseRepository, responseCheckContext.SiteErrorRepository, responseCheckContext.NotificationsRepository);
         checker.CheckResponse(responseCheckContext.Site, responseCheckContext.LastResponse);
     }
     catch (Exception ex)
     {
         Logger.LogError(ex);
     }
 }
示例#23
0
        public void TestPreCreate()
        {
            AlipayTradePrecreateResponse response = Factory.Payment.FaceToFace().PreCreate("iPhone6 16G",
                                                                                           CreateNewAndReturnOutTradeNo(), "0.10");

            Assert.IsTrue(ResponseChecker.Success(response));
            Assert.AreEqual(response.Code, "10000");
            Assert.AreEqual(response.Msg, "Success");
            Assert.IsNull(response.SubCode);
            Assert.IsNull(response.SubMsg);
            Assert.NotNull(response.HttpBody);
            Assert.IsTrue(response.QrCode.StartsWith("https://qr.alipay.com/"));
        }
示例#24
0
        public void TestPayWithOptional()
        {
            AlipayTradeAppPayResponse response = Factory.Payment.App()
                                                 .Agent("ca34ea491e7146cc87d25fca24c4cD11")
                                                 .Optional("extend_params", GetHuabeiConfig())
                                                 .Pay("iPhone6 16G", "f4833085-0c46-4bb0-8e5f-622a02a4cffc", "0.10");

            Assert.IsTrue(ResponseChecker.Success(response));
            Assert.IsTrue(response.Body.Contains("app_auth_token=ca34ea491e7146cc87d25fca24c4cD11&app_id=2019022663440152&biz_content=%7b%22subject%22%3a%22iPhone6+16G%22%2c"
                                                 + "%22out_trade_no%22%3a%22f4833085-0c46-4bb0-8e5f-622a02a4cffc%22%2c%22total_amount%22%3a%220"
                                                 + ".10%22%2c%22extend_params%22%3a%7b%22hb_fq_num%22%3a%223%22%2c%22hb_fq_seller_percent%22%3a%22100%22%7d%7d&charset=UTF"
                                                 + "-8&format=json&method=alipay.trade.app.pay&notify_url=https%3a%2f%2fwww.test.com%2fcallback&sign="));
        }
示例#25
0
        public void TestExecuteWithAppAuthToken()
        {
            string outTradeNo = Guid.NewGuid().ToString();
            AlipayOpenApiGenericResponse response = Factory.Util.Generic().Execute(
                "alipay.trade.create", GetTextParams(), GetBizParams(outTradeNo));

            Assert.IsFalse(ResponseChecker.Success(response));
            Assert.AreEqual(response.Code, "20001");
            Assert.AreEqual(response.Msg, "Insufficient Token Permissions");
            Assert.AreEqual(response.SubCode, "aop.invalid-app-auth-token");
            Assert.AreEqual(response.SubMsg, "无效的应用授权令牌");
            Assert.NotNull(response.HttpBody);
        }
示例#26
0
        public void TestExecuteWithoutAppAuthToken()
        {
            string outTradeNo = Guid.NewGuid().ToString();
            AlipayOpenApiGenericResponse response = Factory.Util.Generic().Execute(
                "alipay.trade.create", null, GetBizParams(outTradeNo));

            Assert.IsTrue(ResponseChecker.Success(response));
            Assert.AreEqual(response.Code, "10000");
            Assert.AreEqual(response.Msg, "Success");
            Assert.IsNull(response.SubCode);
            Assert.IsNull(response.SubMsg);
            Assert.NotNull(response.HttpBody);
        }
示例#27
0
        public void TestCreateTemplate()
        {
            AlipayPassTemplateAddResponse response = Factory.Marketing.Pass().CreateTemplate("123456789", GetTplContent());

            Assert.IsTrue(ResponseChecker.Success(response));
            Assert.AreEqual(response.Code, "10000");
            Assert.AreEqual(response.Msg, "Success");
            Assert.Null(response.SubCode);
            Assert.Null(response.SubMsg);
            Assert.NotNull(response.HttpBody);
            Assert.True(response.Success);
            Assert.True(response.Result.Contains("tpl_id"));
        }
示例#28
0
        public void TestUpdateTemplate()
        {
            AlipayPassTemplateUpdateResponse response = Factory.Marketing.Pass().UpdateTemplate("2020012014534017917956080", GetTplContent());

            Assert.IsTrue(ResponseChecker.Success(response));
            Assert.AreEqual(response.Code, "10000");
            Assert.AreEqual(response.Msg, "Success");
            Assert.Null(response.SubCode);
            Assert.Null(response.SubMsg);
            Assert.NotNull(response.HttpBody);
            Assert.True(response.Success);
            Assert.True(response.Result.Contains("tpl_id"));
        }
示例#29
0
        public void TestGetIndustry()
        {
            AlipayOpenPublicSettingCategoryQueryResponse response = Factory.Marketing.OpenLife().GetIndustry();

            Assert.IsTrue(ResponseChecker.Success(response));
            Assert.AreEqual(response.Code, "10000");
            Assert.AreEqual(response.Msg, "Success");
            Assert.Null(response.SubCode);
            Assert.Null(response.SubMsg);
            Assert.NotNull(response.HttpBody);
            Assert.AreEqual(response.PrimaryCategory, "IT科技/IT软件与服务");
            Assert.AreEqual(response.SecondaryCategory, "IT科技/IT软件与服务");
        }
示例#30
0
        public void TestDetect()
        {
            AlipaySecurityRiskContentDetectResponse response = Factory.Security.TextRisk().Detect("test");

            Assert.IsTrue(ResponseChecker.Success(response));
            Assert.AreEqual(response.Code, "10000");
            Assert.AreEqual(response.Msg, "Success");
            Assert.Null(response.SubCode);
            Assert.Null(response.SubMsg);
            Assert.NotNull(response.HttpBody);
            Assert.AreEqual(response.Action, "PASSED");
            Assert.NotNull(response.UniqueId);
        }
        private void NegotiateWithNegotiateContexts(
            DialectRevision clientMaxDialectSupported,
            PreauthIntegrityHashID[] preauthHashAlgs,
            EncryptionAlgorithm[] encryptionAlgs = null,
            ResponseChecker<NEGOTIATE_Response> checker = null)
        {
            // ensure clientMaxDialectSupported higher than 3.11
            if (clientMaxDialectSupported < DialectRevision.Smb311) clientMaxDialectSupported = DialectRevision.Smb311;
            DialectRevision[] negotiateDialects = Smb2Utility.GetDialects(clientMaxDialectSupported);

            if (clientMaxDialectSupported > TestConfig.MaxSmbVersionClientSupported)
            {
                BaseTestSite.Assert.Inconclusive("Stop to run this test case because the configured MaxSmbVersionClientSupported {0} is lower than {1}.",
                    TestConfig.MaxSmbVersionClientSupported,
                    clientMaxDialectSupported);
            }

            status = client.NegotiateWithContexts(
                Packet_Header_Flags_Values.NONE,
                negotiateDialects,
                preauthHashAlgs: preauthHashAlgs,
                encryptionAlgs: encryptionAlgs,
                checker: checker);
        }