public void HRefEqualsToString()
        {
            Assert.NotNull(ReferenceLink.BaseUrl);

            var mockOwner = new MockOwner();

            Assert.Equal(mockOwner.Links.Self.HRef, mockOwner.Links.Self.ToString());
        }
        public void HRefWithToken()
        {
            Assert.NotNull(ReferenceLink.BaseUrl);

            var mockOwner         = new MockOwner();
            var mockOwnerIdToFind = Guid.NewGuid();

            var href = mockOwner.Links.Find.ToString((token) => mockOwnerIdToFind.ToString());

            Assert.EndsWith(mockOwnerIdToFind.ToString(), href);
        }
        public void LinksCalculatedForFreshInstances()
        {
            Assert.NotNull(ReferenceLink.BaseUrl);

            var mockOwner = new MockOwner();

            Assert.StartsWith(ReferenceLink.BaseUrl, mockOwner.Links.Self.ToString());
            Assert.EndsWith(mockOwner.Id.ToString(), mockOwner.Links.Self.ToString());

            mockOwner.Id = Guid.NewGuid();

            Assert.StartsWith(ReferenceLink.BaseUrl, mockOwner.Links.Self.ToString());
            Assert.EndsWith(mockOwner.Id.ToString(), mockOwner.Links.Self.ToString());
        }
        public void SerializeDeserialize()
        {
            Assert.NotNull(ReferenceLink.BaseUrl);

            var mockOwner     = new MockOwner();
            var mockOwnerJson = JObject.FromObject(mockOwner);

            AssertMockOwnerJson(mockOwnerJson);

            var mockOwner2     = mockOwnerJson.ToObject <MockOwner>();
            var mockOwnerJson2 = JObject.FromObject(mockOwner2);

            AssertMockOwnerJson(mockOwnerJson2);

            Assert.Equal(mockOwnerJson, mockOwnerJson2);
        public void SerializeDeserialize()
        {
            Assert.NotNull(ReferenceLink.BaseUrl);

            var mockOwner     = new MockOwner();
            var mockOwnerJson = JObject.FromObject(mockOwner);

            AssertMockOwnerJson(mockOwnerJson);

            var mockOwner2     = mockOwnerJson.ToObject <MockOwner>();
            var mockOwnerJson2 = JObject.FromObject(mockOwner2);

            AssertMockOwnerJson(mockOwnerJson2);

            Assert.Equal(mockOwnerJson, mockOwnerJson2);

            void AssertMockOwnerJson(JObject json)
            {
                Assert.NotNull(json.SelectToken("$._links._self"));
            }
        }