public void SetAttributes_SetsRepresentorAttributes() { var attributes = new JObject(); sut.SetAttributes(attributes); var result = sut.ToRepresentor(); Assert.AreEqual(attributes, result.Attributes); }
private CrichtonRepresentor CreateRequestRepresentor(Request request) { var builder = new RepresentorBuilder(); // attributes builder.SetAttributes(new JObject(new List <JProperty> { new JProperty("request_uuid", request.RequestUuid), new JProperty("query", request.Query), new JProperty("from", FormatDateTime(request.From)), new JProperty("to", FormatDateTime(request.To)), new JProperty("success", request.Success), new JProperty("status_message", request.StatusMessage), new JProperty("request_time", FormatDateTime(request.RequestTime)), new JProperty("completed_request_time", FormatDateTime(request.CompletedRequestTime)), new JProperty("apps", request.Apps), new JProperty("exceptionApps", request.ExceptionApps), new JProperty("callback_endpoint", request.CallbackEndpoint ?? string.Empty) })); // _link var requestUri = new Uri(_baseUri, RequestPrefix); builder.SetSelfLink(CreateLink(request.RequestUuid.ToString())); builder.AddTransition(new CrichtonTransition { Rel = "logs", Uri = CreateLink(request.RequestUuid.ToString()) + "/logs" }); return(builder.ToRepresentor()); }
private CrichtonRepresentor CreateLogSearchRequestRepresentor(Request request) { var builder = new RepresentorBuilder(); // attributes builder.SetAttributes(new JObject(new List <JProperty> { new JProperty("request_uuid", request.RequestUuid), new JProperty("query", request.Query), new JProperty("from", FormatDateTime(request.From)), new JProperty("to", FormatDateTime(request.To)), new JProperty("callback_endpoint", request.CallbackEndpoint ?? string.Empty) })); // _link var requestUri = new Uri(_baseUri, RequestPrefix); builder.SetSelfLink(CreateLink(request.RequestUuid.ToString())); return(builder.ToRepresentor()); }