public void DiaryUnitTest()
        {
            IService service = ServiceFactory.getInstance().getService(service_type.PUBLISH_TRAVEL_DIARY);
            PublishTravelDiaryRequest serviceRequest = new PublishTravelDiaryRequest();

            TravelDiary td = new TravelDiary();
            td.userId = 9;
            td.tags = "3452,532,df3";
            td.content = "fajlsfjlkjl3kj4lk3j4l34lj343";
            td.title = "zhangzhenrep9834";
            Category c = new Category();
            c.categoryId = 2;
            c.categoryName = "oversea";
            td.belongCategory = c;
            td.addrs = new  List<string>();

            td.addrs.Add("fjladsfjkdsf");
            td.addrs.Add("fjladsfjkdsfd");
            td.addrs.Add("fjladsfjkdsfh");
            serviceRequest.diary = td;

            ServiceRequest request = new ServiceRequest(serviceRequest);
            ServiceResponse response = new ServiceResponse();
            service.process(request, response);

            Assert.AreEqual(0, response.returnCode);
        }
Ejemplo n.º 2
0
        private string SubmitArticle()
        {
            JavaScriptSerializer jss = new JavaScriptSerializer();
            var paramDes = jss.Deserialize<TravelDiary>(Request["queryParam"]);

            PublishTravelDiaryRequest registerReq = new PublishTravelDiaryRequest();
            registerReq.diary = paramDes;

            ServiceRequest request = new ServiceRequest(registerReq);
            ServiceResponse response = new ServiceResponse();

            IService service = ServiceFactory.getInstance().getService(service_type.PUBLISH_TRAVEL_DIARY);

            service.process(request, response);
            PublishTravelDiaryResponse responseU = (PublishTravelDiaryResponse)response.responseObj;
            return responseU.diaryId.ToString();
        }