public void AddLinkReturnsCorrectResult(
            AtomFeed sut,
            AtomLink newLink)
        {
            AtomFeed actual = sut.AddLink(newLink);

            var expected = sut.AsSource().OfLikeness <AtomFeed>()
                           .With(x => x.Links).EqualsWhen(
                (s, d) => sut.Links.Concat(new[] { newLink }).SequenceEqual(d.Links));

            expected.ShouldEqual(actual);
        }
Exemple #2
0
        public AtomFeed Create()
        {
            AtomFeed feed = new AtomFeed(GetFeedID(), GetFeedTitle(), DateTime.MinValue);

              foreach (AtomPersonConstruct author in GetFeedAuthors()) {
            feed.AddAuthor(author);
              }

              foreach (AtomCategory category in GetFeedCategories()) {
            feed.AddCategory(category);
              }

              foreach (AtomPersonConstruct contributor in GetFeedContributors()) {
            feed.AddContributor(contributor);
              }

              feed.Generator = GetFeedGenerator();

              feed.Icon = GetFeedIcon();

              foreach (AtomLink link in GetFeedLinks()) {
            feed.AddLink(link);
              }

              feed.Logo = GetFeedLogo();

              feed.Rights = GetFeedRights();

              feed.Subtitle = GetFeedSubtitle();

              foreach (AtomEntry entry in GetFeedEntries()) {
            feed.Entries.Add(entry);
            if (entry.Updated > feed.Updated) {
              feed.Updated = entry.Updated;
            }
              }

              if (feed.Entries.Count == 0) {
            feed.Updated = GetFeedUpdated();
              }

              return feed;
        }