Build() private method

private Build ( [ retrievalMethod, [ handler, [ keepDownloads = null ) : Implementation
retrievalMethod [
handler [
keepDownloads [
return Implementation
Ejemplo n.º 1
0
        public void BuildSingleFile()
        {
            using (var originalStream = SingleFileData.ToStream())
                using (var microServer = new MicroServer(SingleFileName, originalStream))
                {
                    var implementation = ImplementationUtils.Build(new SingleFile {
                        Href = microServer.FileUri, Destination = SingleFileName
                    }, new SilentTaskHandler());
                    Assert.AreEqual(_singleFileSha256Digest, "sha256new_" + implementation.ManifestDigest.Sha256New);

                    var file = (SingleFile)implementation.RetrievalMethods[0];
                    Assert.AreEqual(originalStream.Length, file.Size);
                }
        }
Ejemplo n.º 2
0
        public void BuildSingleFile()
        {
            using var originalStream = SingleFileData.ToStream();
            using var microServer    = new MicroServer(SingleFileName, originalStream);
            var implementation = ImplementationUtils.Build(new SingleFile {
                Href = microServer.FileUri, Destination = SingleFileName
            }, new SilentTaskHandler());

            ("sha256new_" + implementation.ManifestDigest.Sha256New).Should().Be(_singleFileSha256Digest);

            var file = (SingleFile)implementation.RetrievalMethods[0];

            file.Size.Should().Be(originalStream.Length);
        }
Ejemplo n.º 3
0
        public void BuildArchive()
        {
            using (var stream = typeof(ExtractorTest).GetEmbeddedStream("testArchive.zip"))
                using (var microServer = new MicroServer("archive.zip", stream))
                {
                    var implementation = ImplementationUtils.Build(new Archive {
                        Href = microServer.FileUri
                    }, new SilentTaskHandler());
                    Assert.AreEqual(ArchiveSha256Digest, implementation.ManifestDigest.Sha256New);

                    var archive = (Archive)implementation.RetrievalMethods[0];
                    Assert.AreEqual(Archive.MimeTypeZip, archive.MimeType);
                    Assert.AreEqual(stream.Length, archive.Size);
                }
        }
Ejemplo n.º 4
0
        public void BuildArchive()
        {
            using var stream      = typeof(ImplementationUtilsTest).GetEmbeddedStream("testArchive.zip");
            using var microServer = new MicroServer("archive.zip", stream);
            var implementation = ImplementationUtils.Build(new Archive {
                Href = microServer.FileUri
            }, new SilentTaskHandler());

            implementation.ManifestDigest.Sha256New.Should().Be(ArchiveSha256Digest);

            var archive = (Archive)implementation.RetrievalMethods[0];

            archive.MimeType.Should().Be(Archive.MimeTypeZip);
            archive.Size.Should().Be(stream.Length);
        }
Ejemplo n.º 5
0
        public void BuildRecipe()
        {
            using (var stream = typeof(ArchiveExtractorTest).GetEmbeddedStream("testArchive.zip"))
                using (var microServer = new MicroServer("archive.zip", stream))
                {
                    var implementation = ImplementationUtils.Build(new Recipe {
                        Steps = { new Archive {
                                      Href = microServer.FileUri
                                  } }
                    }, new SilentTaskHandler());
                    implementation.ManifestDigest.Sha256New.Should().Be(ArchiveSha256Digest);

                    var archive = (Archive)((Recipe)implementation.RetrievalMethods[0]).Steps[0];
                    archive.MimeType.Should().Be(Archive.MimeTypeZip);
                    archive.Size.Should().Be(stream.Length);
                }
        }