Exemplo n.º 1
0
        private JsonTransportResponse HandleQueryEntityVersionsRequest(JsonTransportRequest request)
        {
            var requestParams = QueryEntityVersionsRequest.FromJArray((JArray)request.Body);
            var response      = _participant.QueryEntityVersions(requestParams);

            return(new JsonTransportResponse(200, response.ToJArray()));
        }
Exemplo n.º 2
0
 public QueryEntityVersionsResponse QueryEntityVersions(QueryEntityVersionsRequest request)
 {
     return(new QueryEntityVersionsResponse(new List <EntityVersion>
     {
         new EntityVersion("id1", new List <string> {
             "abc", "def"
         }, new DateTime(), "vsn1")
     }));
 }
        public void ShouldCreateRequestFromJArray()
        {
            var jsonString      = @"[
	            {
		            ""attributes"": {""lower"": ""2011-01-01T00:00:00.000Z"",
									 ""upper"": ""2011-12-31T23:59:59.999Z""},
		            ""values"": null,
		            ""category"": ""bizDate""
                }
            ]";
            var wireConstraints = JArray.Parse(jsonString);
            var request         = QueryEntityVersionsRequest.FromJArray(wireConstraints);

            Assert.AreEqual("bizDate", request.Constraints[0].Category);
            Assert.AreEqual(null, request.Constraints[0].Values);
            Assert.AreEqual(new DateTime(2011, 1, 1), DateTime.Parse(request.Constraints[0].Attributes["lower"]).ToUniversalTime());
            Assert.AreEqual(new DateTime(2011, 12, 31, 23, 59, 59, 999),
                            DateTime.Parse(request.Constraints[0].Attributes["upper"]).ToUniversalTime());
        }