コード例 #1
0
        public void TestCreateGroup()
        {
            CreateTerminalGroupRequest request = new CreateTerminalGroupRequest();

            request.Description  = "test group";
            request.Name         = "testgroup6";
            request.ModelName    = "A920";
            request.ResellerName = "reseller a";
            Result <TerminalGroup> result = API.CreateTerminalGroup(request);

            _logger.DebugFormat("Result=\n{0}", JsonConvert.SerializeObject(result));
            Assert.AreEqual(result.BusinessCode, 0);
        }
コード例 #2
0
        public Result <TerminalGroup> CreateTerminalGroup(CreateTerminalGroupRequest createTerminalGroupRequest)
        {
            List <string> validationErrs = new List <string>();

            if (createTerminalGroupRequest == null)
            {
                validationErrs.Add(GetMsgByKey("parameterCreateTerminalGroupRequestNull"));
                return(new Result <TerminalGroup>(validationErrs));
            }
            RestRequest request     = new RestRequest(CREATE_TERMINAL_GROUP_URL, Method.POST);
            var         requestJson = JsonConvert.SerializeObject(createTerminalGroupRequest);

            request.AddParameter(Constants.CONTENT_TYPE_JSON, requestJson, ParameterType.RequestBody);
            string responseContent        = Execute(request);
            TerminalGroupResponse  resp   = JsonConvert.DeserializeObject <TerminalGroupResponse>(responseContent);
            Result <TerminalGroup> result = new Result <TerminalGroup>(resp);

            return(result);
        }