public void WhenPresentedWithResouceIdForNonCurrentFeedReturnsAccessorThatGetsArchiveFeedFromStore() { IStore store = CreateStubStore(); IFeedMappings feedMappings = new FeedMappings(IdConverter, new ResourceId(CurrentFeedResourceId), new StoreId<string>(CurrentFeedStoreId)); Func<IStore, IRepresentation> accessor = feedMappings.CreateFeedAccessor(new ResourceId(ArchiveFeedResourceId)); IRepresentation representation = accessor.Invoke(store); Output output = Output.For(representation); Assert.AreEqual("max-age=10000", output.CacheControl); Assert.AreEqual(StreamBackedRepresentation.CreateArchiveFeed().GetContents(), output.EntityBody); }
public void WhenPresentedWithResouceIdForCurrentFeedReturnsAccessorThatGetsCurrentFeedFromStore() { IStore store = CreateStubStore(); IFeedMappings feedMappings = new FeedMappings(IdConverter, new ResourceId(CurrentFeedResourceId), new StoreId<string>(CurrentFeedStoreId)); Func<IStore, IRepresentation> accessor = feedMappings.CreateFeedAccessor(new ResourceId(CurrentFeedResourceId)); IRepresentation result = accessor.Invoke(store); Output output = Output.For(result); Assert.AreEqual("max-age=10", output.CacheControl); SyndicationFeed recent = SyndicationFeed.Load(XmlReader.Create(ResourceStreams.CurrentFeed())); SyndicationFeed current = SyndicationFeed.Load(XmlReader.Create(new StringReader(output.EntityBody))); Assert.IsNull(current.GetViaLink()); Assert.AreEqual(recent.GetViaLink().GetAbsoluteUri(), current.GetSelfLink().GetAbsoluteUri()); }