public void UsesCustomIdInRelationships() { var person = new PersonWithDifferentId(id: "abc", prefill: true); var resource = new PersonWithDifferentIdResource(); var target = new ResourceSerializer(person, resource, GetUri(id: "abc"), DefaultPathBuilder, null, null, null); var result = target.Serialize(); _output.WriteLine(result.ToString()); var id = result["data"]["relationships"]["job"]["data"].Value <string>("id"); Assert.Equal(person.Job.CompanyId, id); }
public void UsesCustomIdInRelationships() { var person = new PersonWithDifferentId(id: "abc", prefill: true); var resource = new PersonWithDifferentIdResource(); var target = new ResourceSerializer(urlBuilder: new DefaultUrlPathBuilder("/api")); var resourceResult = new ResourceResult { Resource = resource, Result = person }; var result = JToken.Parse(target.Serialize(resourceResult, GetUri(id: "abc").ToString())); _output.WriteLine(result.ToString()); var id = result["data"]["relationships"]["job"]["data"].Value <string>("id"); Assert.Equal(person.Job.CompanyId, id); }