コード例 #1
0
        public void TestGetImplementation()
        {
            var digest1 = new ManifestDigest(sha256: "123");
            var implementation1 = new Implementation {ManifestDigest = digest1};
            var feed1 = new Feed {Elements = {implementation1}};
            var digest2 = new ManifestDigest(sha256: "abc");
            var implementation2 = new Implementation {ManifestDigest = digest2};
            var feed2 = new Feed {Elements = {implementation2}};
            var feeds = new[] {feed1, feed2};

            Feed feed;
            Assert.AreEqual(implementation1, feeds.GetImplementation(digest1, out feed));
            Assert.AreEqual(feed1, feed);

            Assert.AreEqual(implementation2, feeds.GetImplementation(digest2, out feed));
            Assert.AreEqual(feed2, feed);

            Assert.IsNull(feeds.GetImplementation(new ManifestDigest(sha256: "invalid"), out feed), "No implementation should have been found");
            Assert.IsNull(feed, "No feed should have been found");
        }