public void TestQueryOrganizationsJson() { string serviceUri = string.Format("/OrganizationService.svc/json/QueryOrganizations?pageindex={0}&pagesize={1}&orderby={2}", 0,10,""); WebServiceQueryPredicate predicate = new WebServiceQueryPredicate() { Expression = "OrganizationId=@0", Parameters = new WebServiceQueryPredicateParameter[] { new WebServiceQueryPredicateParameter() { Name = "SearchById", Type = WebServiceQueryPredicateParameterTypes.Guid, Value = organizationObject.OrganizationId.ToString() } } }; string content = TestServicesHelper.GetResponse<HttpWebRequest>(serviceUri, userName, password, TestServicesHelper.PostDataByJsonWithContent,TestServicesHelper.GenerateJsonByType(predicate),null); OrganizationQueryResult result = TestServicesHelper.GenerateObjectByJson<OrganizationQueryResult>(content); var obj = result.Where(x => x.OrganizationId == organizationObject.OrganizationId); Assert.IsTrue(obj != null); }
public void TestQueryConcreteDataJson() { string serviceUri = string.Format("/ConcreteDataService.svc/json/QueryConcreteData?pageindex={0}&pagesize={1}&orderby={2}", 0, 10, "CreatedDate"); WebServiceQueryPredicateParameter parameter = new WebServiceQueryPredicateParameter() { Name = "Guid",Type = WebServiceQueryPredicateParameterTypes.String,Value = master.Name }; WebServiceQueryPredicate predicate = new WebServiceQueryPredicate() { Expression = "Name=@0", Parameters = new WebServiceQueryPredicateParameter[] {parameter} }; string response = TestServicesHelper.GetResponse<HttpWebRequest>(serviceUri, userName, password, TestServicesHelper.PostDataByJsonWithContent,TestServicesHelper.GenerateJsonByType(predicate),null); ConcreteDataQueryResult results = TestServicesHelper.GenerateObjectByJson<ConcreteDataQueryResult>(response); var result = results.Where(x => x.Id == master.Id).Select(x => x.Id); Assert.IsTrue(result.Contains(master.Id)); }