public void FullCreateAtomLinkTest()
        {
            DateTime updatedDate = DateTime.Now;

            AtomLink atomLink = new AtomLink()
            {
                Base = new Uri("http://base.com"),
                Count = 0,
                Href = new Uri("http://href.com"),
                Lang = "EN",
                Title = "Test Link",
                HrefLang = "EN",
                Length = "10",
                Rel = "foo",
                Type = "http",
                Updated = updatedDate
            };

            Assert.IsNotNull(atomLink);
            Assert.IsNotNull(atomLink.Base);
            Assert.IsNotNull(atomLink.Href);

            Assert.AreEqual(new Uri("http://base.com"), atomLink.Base);
            Assert.AreEqual(0, atomLink.Count);
            Assert.AreEqual(new Uri("http://href.com"), atomLink.Href);
            Assert.AreEqual("EN", atomLink.Lang);
            Assert.AreEqual("Test Link", atomLink.Title);
            Assert.AreEqual("EN", atomLink.HrefLang);
            Assert.AreEqual("10", atomLink.Length);
            Assert.AreEqual("foo", atomLink.Rel);
            Assert.AreEqual("http", atomLink.Type);
            Assert.AreEqual(updatedDate, atomLink.Updated);
        }
    public static void Merge(this IList<AtomLink> links, AtomLink link)
    {
      //remove old link
      var old = links.Where(l => l.Rel == link.Rel && l.Type == link.Type).ToList();
      for (int i = 0; i < old.Count(); i++) links.Remove(old[i]);

      //add new link
      links.Add(link);
    }
        public static void AssertLinksEqual(AtomLink link, AtomLink testLink)
        {
            Assert.AreEqual(link.Href, testLink.Href);
            Assert.AreEqual(link.Title, testLink.Title);
            Assert.AreEqual(link.Count, testLink.Count);
            Assert.AreEqual(link.HrefLang, testLink.HrefLang);
            Assert.AreEqual(link.Length, testLink.Length);
            Assert.AreEqual(link.Rel, testLink.Rel);
            Assert.AreEqual(link.Type, testLink.Type);

            if (link.Updated.HasValue)
            {
                Assert.IsTrue(testLink.Updated.HasValue);
                AssertDatesApproximatelyEqual(link.Updated.Value, testLink.Updated.Value);
            }
        }
        public void SimpleCreateAtomLinkTest()
        {
            AtomLink atomLink = new AtomLink();

            Assert.IsNotNull(atomLink);
        }
        internal static List<AtomLink> MakeLinks(int count)
        {
            List<AtomLink> result = new List<AtomLink>();

            for (int loopIndex = 0; loopIndex < count; loopIndex++)
            {

                AtomLink atomLink = new AtomLink()
                    {
                        Base = new Uri("http://base.com"),
                        Count = 0,
                        Href = new Uri("http://link" + loopIndex.ToString() + ".com"),
                        Lang = "EN",
                        Title = "Test Link " + loopIndex.ToString()
                    };

                result.Add(atomLink);
            }

            return result;
        }