Exemple #1
0
        public void HateoasLink_UriSelf_NullHref_ThrowsException()
        {
            Uri href = null;

            _ = Assert.Throws <ArgumentNullException>(
                () => HateoasLink.Self(href));
        }
Exemple #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);
        }
Exemple #3
0
        public void HateoasLink_StringSelf_SetsHref()
        {
            string href = "https://www.example.com/";

            var link = HateoasLink.Self(href);

            Assert.Equal(href, link.Href.AbsoluteUri);
        }
Exemple #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);
        }
Exemple #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);
        }
Exemple #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);
        }
Exemple #7
0
 public void HateoasLink_StringSelf_NonUriHref_ThrowsException(
     string href)
 {
     _ = Assert.Throws <UriFormatException>(
         () => HateoasLink.Self(href));
 }