GenerateDigest() private method

private GenerateDigest ( [ path, [ handler, [ keepDownloads = null ) : ManifestDigest
path [
handler [
keepDownloads [
return ManifestDigest
コード例 #1
0
        public void TestGenerateDigest()
        {
            using (var packageDir = new TemporaryDirectory("0install-unit-tests"))
            {
                new PackageBuilder().AddFolder("subdir")
                .AddFile("file", "AAA", new DateTime(2000, 1, 1))
                .WritePackageInto(packageDir);

                ManifestDigest digest1 = ImplementationUtils.GenerateDigest(packageDir, new MockTaskHandler());
                Assert.IsNullOrEmpty(digest1.Sha1); // sha1 is deprecated
                Assert.IsNotNullOrEmpty(digest1.Sha1New);
                Assert.IsNotNullOrEmpty(digest1.Sha256);
                Assert.IsNotNullOrEmpty(digest1.Sha256New);

                ManifestDigest digest2 = ImplementationUtils.GenerateDigest(packageDir, new MockTaskHandler());
                Assert.AreEqual(digest1, digest2);
            }
        }
コード例 #2
0
        public void GenerateDigest()
        {
            using (var packageDir = new TemporaryDirectory("0install-unit-tests"))
            {
                new PackageBuilder().AddFolder("subdir")
                .AddFile("file", "AAA", new DateTime(2000, 1, 1))
                .WritePackageInto(packageDir);

                ManifestDigest digest1 = ImplementationUtils.GenerateDigest(packageDir, new MockTaskHandler());
                digest1.Sha1.Should().BeNullOrEmpty(because: "sha1 is deprecated");
                digest1.Sha1New.Should().NotBeNullOrEmpty();
                digest1.Sha256.Should().NotBeNullOrEmpty();
                digest1.Sha256New.Should().NotBeNullOrEmpty();

                ManifestDigest digest2 = ImplementationUtils.GenerateDigest(packageDir, new MockTaskHandler());
                digest2.Should().Be(digest1);
            }
        }