public void Url_UnknownProtocol()
        {
            UrlMembershipCondition umc = new UrlMembershipCondition("mono://www.go-mono.com");

#if NET_2_0
            Assert.AreEqual("mono://www.go-mono.com", umc.Url, "Url");
            Assert.AreEqual("Url - mono://www.go-mono.com", umc.ToString(), "ToString");
#else
            Assert.AreEqual("mono://www.go-mono.com/", umc.Url, "Url");
            Assert.AreEqual("Url - mono://www.go-mono.com/", umc.ToString(), "ToString");
#endif
        }
        public void Url_NoProtocol()
        {
            UrlMembershipCondition umc = new UrlMembershipCondition("www.go-mono.com");

#if NET_2_0
            Assert.AreEqual("www.go-mono.com", umc.Url, "Url");
            Assert.AreEqual("Url - www.go-mono.com", umc.ToString(), "ToString");
#else
            // note: no last slash here
            Assert.AreEqual("file://WWW.GO-MONO.COM", umc.Url, "Url");
            Assert.AreEqual("Url - file://WWW.GO-MONO.COM", umc.ToString(), "ToString");
#endif
        }
        public void Url_UnknownProtocol()
        {
            UrlMembershipCondition umc = new UrlMembershipCondition("mono://www.example.com");

            Assert.AreEqual("mono://www.example.com", umc.Url, "Url");
            Assert.AreEqual("Url - mono://www.example.com", umc.ToString(), "ToString");
        }
        public void Url_NoProtocol()
        {
            UrlMembershipCondition umc = new UrlMembershipCondition("www.go-mono.com");

            Assert.AreEqual("www.go-mono.com", umc.Url, "Url");
            Assert.AreEqual("Url - www.go-mono.com", umc.ToString(), "ToString");
        }
        public void Url_WellKnownProtocol()
        {
            UrlMembershipCondition umc = new UrlMembershipCondition("http://www.go-mono.com");

#if NET_2_0
            Assert.AreEqual("http://www.go-mono.com", umc.Url, "http-Url");
            Assert.AreEqual("Url - http://www.go-mono.com", umc.ToString(), "http-ToString");
#else
            Assert.AreEqual("http://www.go-mono.com/", umc.Url, "http-Url");
            Assert.AreEqual("Url - http://www.go-mono.com/", umc.ToString(), "http-ToString");
#endif
            umc = new UrlMembershipCondition("https://www.go-mono.com");
#if NET_2_0
            Assert.AreEqual("https://www.go-mono.com", umc.Url, "https-Url");
            Assert.AreEqual("Url - https://www.go-mono.com", umc.ToString(), "https-ToString");
#else
            Assert.AreEqual("https://www.go-mono.com/", umc.Url, "https-Url");
            Assert.AreEqual("Url - https://www.go-mono.com/", umc.ToString(), "https-ToString");
#endif

            umc = new UrlMembershipCondition("ftp://www.go-mono.com");
#if NET_2_0
            Assert.AreEqual("ftp://www.go-mono.com", umc.Url, "ftp-Url");
            Assert.AreEqual("Url - ftp://www.go-mono.com", umc.ToString(), "ftp-ToString");
#else
            Assert.AreEqual("ftp://www.go-mono.com/", umc.Url, "ftp-Url");
            Assert.AreEqual("Url - ftp://www.go-mono.com/", umc.ToString(), "ftp-ToString");
#endif

            umc = new UrlMembershipCondition("file://www.go-mono.com");
#if NET_2_0
            Assert.AreEqual("file://www.go-mono.com", umc.Url, "file-Url");
            Assert.AreEqual("Url - file://www.go-mono.com", umc.ToString(), "file-ToString");
#else
            Assert.AreEqual("file://WWW.GO-MONO.COM", umc.Url, "file-Url");
            Assert.AreEqual("Url - file://WWW.GO-MONO.COM", umc.ToString(), "file-ToString");
#endif
        }
        public void Url_WellKnownProtocol()
        {
            UrlMembershipCondition umc = new UrlMembershipCondition("http://www.example.com");

            Assert.AreEqual("http://www.example.com", umc.Url, "http-Url");
            Assert.AreEqual("Url - http://www.example.com", umc.ToString(), "http-ToString");
            umc = new UrlMembershipCondition("https://www.example.com");
            Assert.AreEqual("https://www.example.com", umc.Url, "https-Url");
            Assert.AreEqual("Url - https://www.example.com", umc.ToString(), "https-ToString");

            umc = new UrlMembershipCondition("ftp://www.example.com");
            Assert.AreEqual("ftp://www.example.com", umc.Url, "ftp-Url");
            Assert.AreEqual("Url - ftp://www.example.com", umc.ToString(), "ftp-ToString");

            umc = new UrlMembershipCondition("file://www.example.com");
            Assert.AreEqual("file://www.example.com", umc.Url, "file-Url");
            Assert.AreEqual("Url - file://www.example.com", umc.ToString(), "file-ToString");
        }
        public void Url_AllGoMonoUrl()
        {
            UrlMembershipCondition umc = new UrlMembershipCondition("http://www.example.com/*");

            Assert.AreEqual("http://www.example.com/*", umc.Url, "Url");
            Assert.AreEqual("Url - http://www.example.com/*", umc.ToString(), "ToString");

            UrlMembershipCondition umc2 = (UrlMembershipCondition)umc.Copy();

            Assert.AreEqual(umc.Url, umc2.Url, "Copy.Url");
            Assert.AreEqual(umc.GetHashCode(), umc2.GetHashCode(), "Copy.GetHashCode");

            SecurityElement        se   = umc2.ToXml();
            UrlMembershipCondition umc3 = new UrlMembershipCondition("*");

            umc3.FromXml(se);
            Assert.AreEqual(umc.Url, umc3.Url, "ToXml/FromXml");

            Assert.IsTrue(umc.Equals(umc2), "Equals");
            UrlMembershipCondition umc4 = new UrlMembershipCondition("http://www.example.com/");

            Assert.IsTrue(umc.Equals(umc4), "Equals-*");
        }
        public void UrlMembershipCondition_GoMonoWebUrl()
        {
            UrlMembershipCondition umc = new UrlMembershipCondition("http://www.example.com/");

            Assert.AreEqual("http://www.example.com/", umc.Url, "Url");
            Assert.AreEqual("Url - http://www.example.com/", umc.ToString(), "ToString");

            UrlMembershipCondition umc2 = (UrlMembershipCondition)umc.Copy();

            Assert.AreEqual(umc.Url, umc2.Url, "Copy.Url");
            Assert.AreEqual(umc.GetHashCode(), umc2.GetHashCode(), "Copy.GetHashCode");

            SecurityElement        se   = umc2.ToXml();
            UrlMembershipCondition umc3 = new UrlMembershipCondition("*");

            umc3.FromXml(se);
            Assert.AreEqual(umc.Url, umc3.Url, "ToXml/FromXml");

            Assert.IsTrue(umc.Equals(umc2), "Equals");
            UrlMembershipCondition umc4 = new UrlMembershipCondition("http://www.example.com");

            // note that a last slash is added to Url - so it's equal
            Assert.IsTrue(umc.Equals(umc4), "Equals-AutoAddedLastSlash");
        }
        public void Url_RelativePath()
        {
            UrlMembershipCondition umc = new UrlMembershipCondition("http://www.example.com/path/../newpath/index.html");

            Assert.AreEqual("http://www.example.com/path/../newpath/index.html", umc.Url, "Url");
            Assert.AreEqual("Url - http://www.example.com/path/../newpath/index.html", umc.ToString(), "ToString");
        }