コード例 #1
0
        public void TestDeleteReseller()
        {
            Result <string> result = API.DeleteReseller(1000005213);

            _logger.DebugFormat("Result=\n{0}", JsonConvert.SerializeObject(result));
            Assert.AreEqual(result.BusinessCode, 0);
        }
コード例 #2
0
        public void TestCreateResellerSuccess()
        {
            ResellerCreateRequest request = new ResellerCreateRequest();

            request.Name               = "TestResellerToDelete3";
            request.Address            = "suzhou";
            request.Email              = "*****@*****.**";
            request.Country            = "CN";
            request.Contact            = "ZhangSan";
            request.Phone              = "22323";
            request.ParentResellerName = "reseller test";
            request.setActivateWhenCreate(false);
            Result <Reseller> result = API.CreateReseller(request);

            _logger.DebugFormat("Result=\n{0}", JsonConvert.SerializeObject(result));
            Assert.AreEqual(result.BusinessCode, 0);


            //Test get reseller by id
            long resellerId = result.Data.ID;


            ResellerUpdateRequest updateRequest = new ResellerUpdateRequest();

            updateRequest.Name               = "TestResellerToDelete4";
            updateRequest.Address            = "suzhou2";
            updateRequest.Email              = "*****@*****.**";
            updateRequest.Country            = "CN";
            updateRequest.Contact            = "ZhangSan2";
            updateRequest.Phone              = "44445555";
            updateRequest.ParentResellerName = "reseller test";
            Result <Reseller> updateResult = API.UpdateReseller(resellerId, updateRequest);

            _logger.DebugFormat("Update Result=\n{0}", JsonConvert.SerializeObject(updateResult));
            Assert.AreEqual(updateResult.BusinessCode, 0);
            Assert.AreEqual("suzhou2", updateResult.Data.Address);
            Assert.AreEqual("ZhangSan2", updateResult.Data.Contact);
            Assert.AreEqual("44445555", updateResult.Data.Phone);



            Result <Reseller> getResellerResult = API.GetReseller(resellerId);

            _logger.DebugFormat("Result=\n{0}", JsonConvert.SerializeObject(getResellerResult));
            Assert.AreEqual(0, getResellerResult.BusinessCode);

            //Test activate reseller
            Result <string> activateResellerResult = API.ActivateReseller(resellerId);

            _logger.DebugFormat("Result=\n{0}", JsonConvert.SerializeObject(activateResellerResult));
            Assert.AreEqual(activateResellerResult.BusinessCode, 0);


            Result <string> replaceEmailResult = API.ReplaceResellerEmail(resellerId, "*****@*****.**");

            _logger.DebugFormat("Result=\n{0}", JsonConvert.SerializeObject(replaceEmailResult));
            Assert.AreEqual(replaceEmailResult.BusinessCode, 0);

            //Test activate reseller already active
            Result <string> activateResellerResult2 = API.ActivateReseller(resellerId);

            _logger.DebugFormat("Result=\n{0}", JsonConvert.SerializeObject(activateResellerResult2));
            Assert.AreEqual(activateResellerResult2.BusinessCode, 1891);


            //Test disable reseller
            Result <string> disableResellerResult = API.DisableReseller(resellerId);

            _logger.DebugFormat("Result=\n{0}", JsonConvert.SerializeObject(disableResellerResult));
            Assert.AreEqual(disableResellerResult.BusinessCode, 0);

            //Test delete
            Result <string> deleteResellerResult = API.DeleteReseller(resellerId);

            _logger.DebugFormat("Result=\n{0}", JsonConvert.SerializeObject(deleteResellerResult));
            Assert.AreEqual(deleteResellerResult.BusinessCode, 0);
        }