public void Download() { var feed = FeedTest.CreateTestFeed(); var feedStream = new MemoryStream(); using var server = new MicroServer("feed.xml", feedStream); feed.Uri = new FeedUri(server.FileUri); feed.SaveXml(feedStream); var data = feedStream.ToArray(); feedStream.Position = 0; _feedManager.IsStale(feed.Uri).Should().BeTrue(because: "Non-cached feeds should be reported as stale"); // No previous feed _feedCacheMock.Setup(x => x.Contains(feed.Uri)).Returns(false); _feedCacheMock.Setup(x => x.GetSignatures(feed.Uri)).Throws <KeyNotFoundException>(); _feedCacheMock.Setup(x => x.Add(feed.Uri, data)); _feedCacheMock.Setup(x => x.GetFeed(feed.Uri)).Returns(feed); _trustManagerMock.Setup(x => x.CheckTrust(data, feed.Uri, It.IsAny <string>())).Returns(OpenPgpUtilsTest.TestSignature); _feedManager[feed.Uri].Should().Be(feed); }