public void UsesDefaultPropertyId()
        {
            var data = new PersonWithNoJob();
            var target = new ResourceSerializer(data, new PersonWithDefaultIdResource(), 
                GetUri(id: "123"), DefaultPathBuilder, null);

            var result = target.Serialize();
            _output.WriteLine(result.ToString());

            var id = result["data"].Value<string>("id");

            Assert.Equal(data.Id, id);
        }
        public void UsesDefaultPropertyId()
        {
            var data = new PersonWithNoJob();
            var target = new ResourceSerializer(urlBuilder: new DefaultUrlPathBuilder("/api"));

            var resourceResult = new ResourceResult
            {
                Resource = new PersonWithDefaultIdResource(),
                Result = data
            };

            var result = JToken.Parse(target.Serialize(resourceResult, GetUri(id: "123").ToString()));
            _output.WriteLine(result.ToString());

            var id = result["data"].Value<string>("id");

            Assert.Equal(data.Id, id);
        }
        public void SerializesRelationshipData()
        {
            var person = new PersonWithNoJob();
            var target = new ResourceSerializer(urlBuilder: new DefaultUrlPathBuilder("/api"));

            var resourceResult = new ResourceResult
            {
                Resource = new PersonWithDefaultIdResource(),
                Result = person
            };

            var result = JToken.Parse(target.Serialize(resourceResult, GetUri(id: "123").ToString()));
            _output.WriteLine(result.ToString());

            var relationships = result["data"]["relationships"];
            var job = relationships["job"];
            var friends = relationships["friends"];

            Assert.Null(job["data"]);
            Assert.NotNull(friends["data"]);
        }
        public void SerializesRelationshipData()
        {
            var person = new PersonWithNoJob();
            var target = new ResourceSerializer(person, new PersonWithDefaultIdResource(), 
                GetUri(id: "123"), DefaultPathBuilder, null);
            var result = target.Serialize();
            _output.WriteLine(result.ToString());

            var relationships = result["data"]["relationships"];
            var job = relationships["job"];
            var friends = relationships["friends"];

            Assert.Null(job["data"]);
            Assert.NotNull(friends["data"]);
        }