コード例 #1
0
        public void AbsoluteUriTest()
        {
            AtomBaseLink target = CreateAtomBaseLink(); // TODO: Initialize to an appropriate value
            AtomUri      actual = new AtomUri(target.AbsoluteUri);

            Assert.AreEqual(target.Uri, actual);
        }
コード例 #2
0
        /////////////////////////////////////////////////////////////////////////////

        //////////////////////////////////////////////////////////////////////
        /// <summary>compares 2 Generator objects</summary>
        /// <param name="theOne">the One</param>
        /// <param name="theOther">the Other</param>
        /// <returns>true if identical </returns>
        //////////////////////////////////////////////////////////////////////
        public static bool IsGeneratorIdentical(AtomGenerator theOne, AtomGenerator theOther)
        {
            if (theOne == null && theOther == null)
            {
                return(true);
            }

            if (!ObjectModelHelper.IsBaseIdentical(theOne, theOther))
            {
                return(false);
            }

            if (String.Compare(theOne.Text, theOther.Text) != 0)
            {
                return(false);
            }
            if (String.Compare(theOne.Version, theOther.Version) != 0)
            {
                return(false);
            }
            if (AtomUri.Compare(theOne.Uri, theOther.Uri) != 0)
            {
                return(false);
            }


            return(true);
        }
コード例 #3
0
        /////////////////////////////////////////////////////////////////////////////

        //////////////////////////////////////////////////////////////////////
        /// <summary>compares 2 content objects</summary>
        /// <param name="theOne">the One content </param>
        /// <param name="theOther">the Other content</param>
        /// <returns>true if identical </returns>
        //////////////////////////////////////////////////////////////////////
        public static bool IsContentIdentical(AtomContent theOne, AtomContent theOther)
        {
            if (theOne == null && theOther == null)
            {
                return(true);
            }


            if (!ObjectModelHelper.IsBaseIdentical(theOne, theOther))
            {
                return(false);
            }
            if (String.Compare(theOne.Type, theOther.Type) != 0)
            {
                return(false);
            }
            if (AtomUri.Compare(theOther.Src, theOther.Src) != 0)
            {
                return(false);
            }

            String content = theOther.Content == null ? "" : theOther.Content;
            String other   = theOne.Content == null ? "" : theOne.Content;


            if (String.Compare(content, other) != 0)
            {
                return(false);
            }

            return(true);
        }
コード例 #4
0
        /////////////////////////////////////////////////////////////////////////////

        //////////////////////////////////////////////////////////////////////
        /// <summary>compares a category</summary>
        /// <param name="theOne">the One category </param>
        /// <param name="theOther">the Other category</param>
        /// <returns>true if identical </returns>
        //////////////////////////////////////////////////////////////////////
        public static bool IsCategoryIdentical(AtomCategory theOne, AtomCategory theOther)
        {
            if (theOne == null && theOther == null)
            {
                return(true);
            }


            if (!ObjectModelHelper.IsBaseIdentical(theOne, theOther))
            {
                return(false);
            }

            if (String.Compare(theOne.Label, theOther.Label) != 0)
            {
                return(false);
            }
            if (String.Compare(theOne.Term, theOther.Term) != 0)
            {
                return(false);
            }
            if (AtomUri.Compare(theOne.Scheme, theOther.Scheme) != 0)
            {
                return(false);
            }

            return(true);
        }
コード例 #5
0
        /////////////////////////////////////////////////////////////////////////////


        //////////////////////////////////////////////////////////////////////
        /// <summary>public static bool IsPersonIdentical(AtomPerson theOne, AtomPerson theOther)</summary>
        /// <param name="theOne">the One Person </param>
        /// <param name="theOther">the Other Person</param>
        /// <returns>true if identical </returns>
        //////////////////////////////////////////////////////////////////////
        public static bool IsPersonIdentical(AtomPerson theOne, AtomPerson theOther)
        {
            if (theOne == null && theOther == null)
            {
                return(true);
            }

            if (!ObjectModelHelper.IsBaseIdentical(theOne, theOther))
            {
                Tracing.TraceInfo("IsPersonIdentical: comparing  base failed");
                return(false);
            }
            Tracing.TraceInfo("IsPersonIdentical: comparing  Name " + theOne.Name + " " + theOther.Name);

            if (String.Compare(theOne.Email, theOther.Email) != 0)
            {
                Tracing.TraceInfo("IsPersonIdentical: comparing  email failed" + theOne.Email + " " + theOther.Email);
                return(false);
            }
            if (String.Compare(theOne.Name, theOther.Name) != 0)
            {
                Tracing.TraceInfo("IsPersonIdentical: comparing  Name failed" + theOne.Name + " " + theOther.Name);
                return(false);
            }
            if (AtomUri.Compare(theOne.Uri, theOther.Uri) != 0)
            {
                Tracing.TraceInfo("IsPersonIdentical: comparing  URI failed - " + theOne.Uri.ToString() + " " + theOther.Uri.ToString());
                return(false);
            }
            return(true);
        }
コード例 #6
0
        public void AbsoluteUriTest()
        {
            AtomLink target   = new AtomLink(); // TODO: Initialize to an appropriate value
            AtomUri  expected = new AtomUri("http://www.test.com/");

            target.HRef = expected;
            Assert.AreEqual(target.AbsoluteUri, "http://www.test.com/");
        }
コード例 #7
0
        public void IsPersistableTest()
        {
            AtomUri uriString = new AtomUri("http://www.test.com/");
            bool    expected  = true; // TODO: Initialize to an appropriate value
            bool    actual;

            actual = Utilities.IsPersistable(uriString);
            Assert.AreEqual(expected, actual);
        }
コード例 #8
0
        public void AtomCategoryConstructorTest()
        {
            string       term   = "term";
            AtomUri      scheme = new AtomUri("scheme");
            AtomCategory target = new AtomCategory(term, scheme);

            Assert.AreEqual(target.Term, term);
            Assert.AreEqual(target.Scheme.ToString(), "scheme");
        }
コード例 #9
0
        public void ToStringTest()
        {
            Uri     uri      = new Uri("http://www.test.com/");
            AtomUri target   = new AtomUri(uri); // TODO: Initialize to an appropriate value
            string  expected = "http://www.test.com/";
            string  actual;

            actual = target.ToString();
            Assert.AreEqual(expected, actual);
        }
コード例 #10
0
        public void op_InequalityTest()
        {
            AtomUri a        = new AtomUri("A");
            AtomUri b        = new AtomUri("B");
            bool    expected = true; // TODO: Initialize to an appropriate value
            bool    actual;

            actual = (a != b);
            Assert.AreEqual(expected, actual);
        }
コード例 #11
0
        public void BaseTest()
        {
            AtomBase target   = CreateAtomBase(); // TODO: Initialize to an appropriate value
            AtomUri  expected = new AtomUri("http://www.test.com/");
            AtomUri  actual;

            target.Base = expected;
            actual      = target.Base;
            Assert.AreEqual(expected, actual);
        }
コード例 #12
0
        public void HRefTest()
        {
            AtomLink target   = new AtomLink(); // TODO: Initialize to an appropriate value
            AtomUri  expected = new AtomUri("http://www.test.com/");
            AtomUri  actual;

            target.HRef = expected;
            actual      = target.HRef;
            Assert.AreEqual(expected, actual);
        }
コード例 #13
0
        public void SrcTest()
        {
            AtomContent target   = new AtomContent(); // TODO: Initialize to an appropriate value
            AtomUri     expected = new AtomUri("http://www.test.com/");
            AtomUri     actual;

            target.Src = expected;
            actual     = target.Src;
            Assert.AreEqual(expected, actual);
        }
コード例 #14
0
        public void UriTest()
        {
            AtomGenerator target   = new AtomGenerator(); // TODO: Initialize to an appropriate value
            AtomUri       expected = new AtomUri("http://www.test.com/");
            AtomUri       actual;

            target.Uri = expected;
            actual     = target.Uri;
            Assert.AreEqual(expected, actual);
        }
コード例 #15
0
        public void UriTest()
        {
            AtomBaseLink target   = CreateAtomBaseLink();
            AtomUri      expected = new AtomUri("http://www.test.com/");
            AtomUri      actual;

            target.Uri = expected;
            actual     = target.Uri;
            Assert.AreEqual(expected, actual);
        }
コード例 #16
0
        public void SchemeTest()
        {
            AtomCategory target   = new AtomCategory(); // TODO: Initialize to an appropriate value
            AtomUri      expected = new AtomUri("scheme");
            AtomUri      actual;

            target.Scheme = expected;
            actual        = target.Scheme;
            Assert.AreEqual(expected, actual);
        }
コード例 #17
0
        public void op_LessThanTest()
        {
            AtomUri a        = new AtomUri("A");
            AtomUri b        = new AtomUri("A");
            bool    expected = false;
            bool    actual;

            actual = (a < b);
            Assert.AreEqual(expected, actual);
        }
コード例 #18
0
        public void AbsoluteUriTest()
        {
            AtomContent target   = new AtomContent(); // TODO: Initialize to an appropriate value
            AtomUri     expected = new AtomUri("http://www.test.com/");

            target.Src = expected;
            string actual;

            actual = target.AbsoluteUri;
            Assert.AreEqual(actual, "http://www.test.com/");
        }
コード例 #19
0
        public void FindTest1()
        {
            AtomCategoryCollection target = new AtomCategoryCollection(); // TODO: Initialize to an appropriate value
            AtomCategory           value  = new AtomCategory("test", "scheme");

            target.Add(value);
            string       term   = "test";
            AtomUri      scheme = new AtomUri("scheme");
            AtomCategory actual;

            actual = target.Find(term, scheme);
            Assert.AreEqual(value, actual);
        }
コード例 #20
0
        /////////////////////////////////////////////////////////////////////////////



        //////////////////////////////////////////////////////////////////////
        /// <summary>public static bool IsBaseIdentical(AtomBase base, AtomBase base2)</summary>
        /// <param name="theOne">the One base </param>
        /// <param name="theOther">the Other base</param>
        /// <returns>true if identical </returns>
        //////////////////////////////////////////////////////////////////////
        public static bool IsBaseIdentical(AtomBase theOne, AtomBase theOther)
        {
            if (theOne == null && theOther == null)
            {
                return(true);
            }

            if (AtomUri.Compare(theOne.Base, theOther.Base) != 0)
            {
                return(false);
            }
            if (String.Compare(theOne.Language, theOther.Language) != 0)
            {
                return(false);
            }
            return(true);
        }
コード例 #21
0
        /////////////////////////////////////////////////////////////////////////////

        //////////////////////////////////////////////////////////////////////
        /// <summary>compares 2 IDs</summary>
        /// <param name="theOne">the One </param>
        /// <param name="theOther">the Other</param>
        /// <returns>true if identical </returns>
        //////////////////////////////////////////////////////////////////////
        public static bool IsBaseLinkIdentical(AtomBaseLink theOne, AtomBaseLink theOther)
        {
            if (theOne == null && theOther == null)
            {
                return(true);
            }

            if (!ObjectModelHelper.IsBaseIdentical(theOne, theOther))
            {
                return(false);
            }
            if (AtomUri.Compare(theOne.Uri, theOther.Uri) != 0)
            {
                return(false);
            }

            return(true);
        }
コード例 #22
0
        /// <summary>
        /// returns the video this activity was related to
        /// </summary>
        /// <param name="activity"></param>
        /// <returns></returns>
        public Video GetVideoForActivity(Activity activity)
        {
            Video rv = null;

            if (activity.ActivityEntry != null)
            {
                AtomUri      address = activity.ActivityEntry.VideoLink;
                YouTubeQuery q       = PrepareQuery <YouTubeQuery>(address.ToString());
                YouTubeFeed  f       = this.Service.Query(q);

                if (f != null && f.Entries.Count > 0)
                {
                    rv           = new Video();
                    rv.AtomEntry = f.Entries[0];
                }
            }

            return(rv);
        }
コード例 #23
0
        /////////////////////////////////////////////////////////////////////////////


        //////////////////////////////////////////////////////////////////////
        /// <summary>compares 2 link objects</summary>
        /// <param name="theOne">the One link</param>
        /// <param name="theOther">the Other link</param>
        /// <returns>true if identical </returns>
        //////////////////////////////////////////////////////////////////////
        public static bool IsLinkIdentical(AtomLink theOne, AtomLink theOther)
        {
            if (theOne == null && theOther == null)
            {
                return(true);
            }

            if (!ObjectModelHelper.IsBaseIdentical(theOne, theOther))
            {
                return(false);
            }

            if (AtomUri.Compare(theOne.HRef, theOther.HRef) != 0)
            {
                return(false);
            }

            if (theOne.Length != theOther.Length)
            {
                return(false);
            }

            if (String.Compare(theOne.Rel, theOther.Rel) != 0)
            {
                return(false);
            }
            if (String.Compare(theOne.Type, theOther.Type) != 0)
            {
                return(false);
            }
            if (String.Compare(theOne.HRefLang, theOther.HRefLang) != 0)
            {
                return(false);
            }
            if (String.Compare(theOne.Title, theOther.Title) != 0)
            {
                return(false);
            }

            return(true);
        }