コード例 #1
0
        public void HateoasLink_UriSelf_NullHref_ThrowsException()
        {
            Uri href = null;

            _ = Assert.Throws <ArgumentNullException>(
                () => HateoasLink.Self(href));
        }
コード例 #2
0
        public void HateoasLink_UriSelf_SetsHref()
        {
            Uri href = new Uri("https://www.example.com/");

            var link = HateoasLink.Self(href);

            Assert.Equal(href, link.Href);
        }
コード例 #3
0
        public void HateoasLink_StringSelf_SetsHref()
        {
            string href = "https://www.example.com/";

            var link = HateoasLink.Self(href);

            Assert.Equal(href, link.Href.AbsoluteUri);
        }
コード例 #4
0
        public void HateoasLink_Self_SerializedJson_ContainsNecessaryData(
            string href, string contains)
        {
            var link = HateoasLink.Self(href);

            var serialized = link.ToJson();

            Assert.Contains(contains, serialized);
        }
コード例 #5
0
        public void HateoasLink_UriSelf_RelIsSelf()
        {
            Uri          href = new Uri("https://www.example.com/");
            const string self = "self";

            var link = HateoasLink.Self(href);

            Assert.Equal(self, link.Rel);
        }
コード例 #6
0
        public void HateoasLink_StringSelf_RelIsSelf()
        {
            string       href = "https://www.example.com/";
            const string self = "self";

            var link = HateoasLink.Self(href);

            Assert.Equal(self, link.Rel);
        }
コード例 #7
0
 public void HateoasLink_StringSelf_NonUriHref_ThrowsException(
     string href)
 {
     _ = Assert.Throws <UriFormatException>(
         () => HateoasLink.Self(href));
 }