public void ShouldSaveFeedToCurrentDirectory()
        {
            InMemoryFileSystem fileSystem = new InMemoryFileSystem();

            RecentEventsFeed recentEventsFeed = new RecentEventsFeedBuilder().WithId(2).WithPreviousId(1).WithUris(SampleLinks.Instance).Build();

            Assert.AreEqual(0, fileSystem.FileCount(fileSystem.CurrentDirectory));

            recentEventsFeed.Save(fileSystem);

            Assert.AreEqual(1, fileSystem.FileCount(fileSystem.CurrentDirectory));

            SyndicationFeed feed = recentEventsFeed.GetSyndicationFeed();
            SyndicationFeed rehydratedFeed = SyndicationFeed.Load(fileSystem.CurrentDirectory.GetXmlReader(recentEventsFeed.GetFeedMapping().GetFileName()));

            Assert.AreEqual(feed.Id, rehydratedFeed.Id);
            Assert.AreEqual(feed.Items.Count(), rehydratedFeed.Items.Count());
            Assert.AreEqual(feed.GetSelfLink().GetAbsoluteUri(), rehydratedFeed.GetSelfLink().GetAbsoluteUri());
            Assert.AreEqual(feed.GetViaLink().GetAbsoluteUri(), rehydratedFeed.GetViaLink().GetAbsoluteUri());
            Assert.AreEqual(feed.GetPrevArchiveLink().GetAbsoluteUri(), rehydratedFeed.GetPrevArchiveLink().GetAbsoluteUri());
        }
        public void ShouldSaveFeedToArchiveDirectory()
        {
            InMemoryFileSystem fileSystem = new InMemoryFileSystem();

            RecentEventsFeed recentEvents = new RecentEventsFeedBuilder().WithId(2).WithPreviousId(1).WithNumberOfEntries(5).Build();
            ArchiveFeed archive = recentEvents.CreateArchiveFeed(recentEvents.CreateNextFeed());

            Assert.AreEqual(0, fileSystem.FileCount(fileSystem.ArchiveDirectory));

            archive.Save(fileSystem);

            Assert.AreEqual(1, fileSystem.FileCount(fileSystem.ArchiveDirectory));

            SyndicationFeed feed = archive.GetSyndicationFeed();

            FileName archiveFileName = recentEvents.GetFeedMapping().WithArchiveFileName().FileName;
            SyndicationFeed rehydrated = SyndicationFeed.Load(fileSystem.ArchiveDirectory.GetXmlReader(archiveFileName));

            Assert.AreEqual(feed.Id, rehydrated.Id);
            Assert.AreEqual(feed.Items.Count(), rehydrated.Items.Count());
            Assert.AreEqual(feed.GetSelfLink().GetAbsoluteUri(), rehydrated.GetSelfLink().GetAbsoluteUri());
            Assert.AreEqual(feed.GetPrevArchiveLink().GetAbsoluteUri(), rehydrated.GetPrevArchiveLink().GetAbsoluteUri());
            Assert.AreEqual(feed.GetNextArchiveLink().GetAbsoluteUri(), rehydrated.GetNextArchiveLink().GetAbsoluteUri());
        }