Exemple #1
0
        public void Constructor_NullUrl()
        {
            vCardWebSite site = new vCardWebSite((string)null);

            Assert.IsEmpty(
                site.Url,
                "The Url should be String.Empty even when initialized to null.");

        }
Exemple #2
0
        public void Constructor_Url_WebSiteType()
        {

            vCardWebSite site = new vCardWebSite(
                TestUrl, vCardWebSiteType.Personal);

            Assert.AreEqual(
                TestUrl,
                site.Url,
                "The URL was not assigned properly by the constructor.");

            Assert.AreEqual(
                vCardWebSiteType.Personal,
                site.WebSiteType,
                "The site type should have been set.");

        }
Exemple #3
0
        public void Constructor()
        {

            // Tests for default values when a web site
            // object is created without parameters.

            vCardWebSite site = new vCardWebSite();

            Assert.AreEqual(
                site.WebSiteType,
                vCardWebSiteType.Default,
                "The site type should be the default.");

            Assert.IsEmpty(
                site.Url,
                "The Url should be String.Empty because it was not initialized.");

        }
Exemple #4
0
        public void Constructor_Url()
        {

            // Tests for values when a web site is created
            // with a URL.

            vCardWebSite site = new vCardWebSite(TestUrl);

            Assert.AreEqual(
                TestUrl,
                site.Url,
                "The URL was not assigned properly by the constructor.");

            Assert.AreEqual(
                vCardWebSiteType.Default,
                site.WebSiteType,
                "The site type should be default because it was not specified.");

        }
Exemple #5
0
        /// <summary>
        ///     Asserts that two web sites are identical.
        /// </summary>
        public static void Equals(vCardWebSite w1, vCardWebSite w2)
        {

            Assert.AreEqual(
                w1.IsPersonalSite,
                w2.IsPersonalSite,
                "vCardWebSite.IsPersonalSite differs.");

            Assert.AreEqual(
                w1.IsWorkSite,
                w2.IsWorkSite,
                "vCardWebSite.IsWorkSite differs.");

            Assert.AreEqual(
                w1.ToString(),
                w2.ToString(),
                "vCardWebSite.ToString() differs.");

            Assert.AreEqual(
                w1.Url,
                w2.Url,
                "vCardWebSite.Url differs.");

            Assert.AreEqual(
                w1.WebSiteType,
                w2.WebSiteType,
                "vCardWebSite.WebSiteType differs.");

        }
Exemple #6
0
        public void ReadWriteProperty_Url()
        {

            vCardWebSite site = new vCardWebSite();

            site.Url = TestUrl;
            Assert.AreEqual(
                TestUrl,
                site.Url,
                "The Url property is not working.");

        }
Exemple #7
0
        public void ReadWriteProperty_WebSiteType()
        {

            vCardWebSite site = new vCardWebSite();

            site.WebSiteType = vCardWebSiteType.Personal;
            
            Assert.AreEqual(
                vCardWebSiteType.Personal,
                site.WebSiteType,
                "The web site type should be set to Personal.");

            Assert.IsTrue(
                site.IsPersonalSite,
                "The IsPersonalSite property should be true.");

            Assert.IsFalse(
                site.IsWorkSite,
                "The IsWorkSite property should be false.");

            site.WebSiteType = vCardWebSiteType.Work;

            Assert.AreEqual(
                vCardWebSiteType.Work,
                site.WebSiteType,
                "The web site type should be set to Work.");

            Assert.IsFalse(
                site.IsPersonalSite,
                "The IsPersonalSite property should be false.");

            Assert.IsTrue(
                site.IsWorkSite,
                "The IsWorkSite property should be true.");

            // Now set both types.

            site.WebSiteType = vCardWebSiteType.Personal | vCardWebSiteType.Work;

            Assert.IsTrue(
                site.IsPersonalSite,
                "The IsPersonalSite property should also be true.");

            Assert.IsTrue(
                site.IsWorkSite,
                "The IsWorkSite property should also be true.");

            Assert.AreEqual(
                vCardWebSiteType.Personal | vCardWebSiteType.Work,
                site.WebSiteType,
                "The WebSiteType property is not working for multiple values.");

        }
Exemple #8
0
        public void ReadWriteProperty_IsWorkSite()
        {

            vCardWebSite site = new vCardWebSite();

            site.IsWorkSite = true;
            Assert.IsTrue(
                site.IsWorkSite,
                "The IsWorkSite property should be true.");

            site.IsWorkSite = false;
            Assert.IsFalse(
                site.IsWorkSite,
                "The IsWorkSite property should be false.");

        }
        /// <summary>
        ///     Reads the URL property.
        /// </summary>
        private void ReadInto_URL(vCard card, vCardProperty property)
        {

            vCardWebSite webSite = new vCardWebSite();

            webSite.Url = property.ToString();
            
            if (property.Subproperties.Contains("HOME"))
                webSite.IsPersonalSite = true;
            
            if (property.Subproperties.Contains("WORK"))
                webSite.IsWorkSite = true;
            
            card.WebSites.Add(webSite);

        }