public void MocklogoutTest()
	    {
		    //define all mocked objects as final
            var mockController = GetMockController<logoutRequest, logoutResponse>();
            var mockRequest = new logoutRequest
                {
                    merchantAuthentication = new merchantAuthenticationType() {name = "mocktest", Item = "mockKey", ItemElementName = ItemChoiceType.transactionKey},
                };
            var mockResponse = new logoutResponse
                {
                    refId = "1234",
                    sessionToken = "sessiontoken",
                };

		    var errorResponse = new ANetApiResponse();
		    var results = new List<String>();
            const messageTypeEnum messageTypeOk = messageTypeEnum.Ok;

            SetMockControllerExpectations<logoutRequest, logoutResponse, logoutController>(
                mockController.MockObject, mockRequest, mockResponse, errorResponse, results, messageTypeOk);
            mockController.MockObject.Execute(AuthorizeNet.Environment.CUSTOM);
            //mockController.MockObject.Execute();
            // or var controllerResponse = mockController.MockObject.ExecuteWithApiResponse(AuthorizeNet.Environment.CUSTOM);
            var controllerResponse = mockController.MockObject.GetApiResponse();
            Assert.IsNotNull(controllerResponse);

		    //Assert.IsNotNull(controllerResponse.);
		    LogHelper.info(Logger, "logout: Details:{0}", controllerResponse);
	    }
        public void MocklogoutTest()
        {
            //define all mocked objects as final
            var mockController = GetMockController <logoutRequest, logoutResponse>();
            var mockRequest    = new logoutRequest
            {
                merchantAuthentication = new merchantAuthenticationType()
                {
                    name = "mocktest", Item = "mockKey", ItemElementName = ItemChoiceType.transactionKey
                },
            };
            var mockResponse = new logoutResponse
            {
                refId        = "1234",
                sessionToken = "sessiontoken",
            };

            var errorResponse = new ANetApiResponse();
            var results       = new List <String>();
            const messageTypeEnum messageTypeOk = messageTypeEnum.Ok;

            SetMockControllerExpectations <logoutRequest, logoutResponse, logoutController>(
                mockController.MockObject, mockRequest, mockResponse, errorResponse, results, messageTypeOk);
            mockController.MockObject.Execute(AuthorizeNet.Environment.CUSTOM);
            //mockController.MockObject.Execute();
            // or var controllerResponse = mockController.MockObject.ExecuteWithApiResponse(AuthorizeNet.Environment.CUSTOM);
            var controllerResponse = mockController.MockObject.GetApiResponse();

            Assert.IsNotNull(controllerResponse);

            //Assert.IsNotNull(controllerResponse.);
            LogHelper.info(Logger, "logout: Details:{0}", controllerResponse);
        }
Beispiel #3
0
        /// <summary>
        ///     注册序列号
        /// </summary>
        /// <returns></returns>
        public static bool Logout()
        {
            string SerialNo = BLL.SysManage.ConfigSystem.GetValueByCache("Emay_SMS_SerialNo");
            string Key      = BLL.SysManage.ConfigSystem.GetValueByCache("Emay_SMS_Key");
            string Pwd      = BLL.SysManage.ConfigSystem.GetValueByCache("Emay_SMS_Pwd");

            if (String.IsNullOrWhiteSpace(SerialNo) || String.IsNullOrWhiteSpace(Key))
            {
                LogHelp.AddErrorLog("亿美短信接口缺少企业序列号或者自定义关键字Key", "亿美短信接口调用失败", HttpContext.Current.Request);
                return(false);
            }
            SMSService.SDKClient sdkClient = new SDKClientClient();
            logoutRequest        request   = new logoutRequest(SerialNo, Key);
            logoutResponse       response  = sdkClient.logout(request);

            if (response.@return == 0)
            {
                return(true);
            }
            string msg = LogoutException(response.@return);

            LogHelp.AddErrorLog("亿美短信注销序列号出现异常,【" + msg + "】", "亿美短信接口调用失败", HttpContext.Current.Request);
            return(false);
        }
 public static void logoutResponse(logoutResponse argument)
 {
     if (null != argument)
     {
     }
 }