示例#1
0
        public void TestGenerateTarGzNoDirectory()
        {
            string nonexistantdir = Path.Combine(tempFolder, "temp");

            Utils.GenerateTarGz(nonexistantdir, null, null);
            Assert.Fail("Expected an IOException as the directory does not exist");
        }
示例#2
0
        public void TestGenerateTarGzEmptyDirectory()
        {
            // create an empty directory
            string emptydir = Path.Combine(tempFolder, "subfolder");

            Directory.CreateDirectory(emptydir);
            byte[] data = Utils.GenerateTarGz(emptydir, null, null);

            // Here, we simply ensure that it did something!
            Assert.IsNotNull(data);
            Assert.IsTrue(data.Length > 0);
        }
示例#3
0
        public void TestGenerateTarGz()
        {
            // create a temp directory with some files in it
            string tempDir = CreateTempDirWithFiles();

            // Compress
            byte[] data = Utils.GenerateTarGz(tempDir, "newPath", null);

            // Here, we simply ensure that it did something!
            Assert.IsNotNull(data);
            Assert.IsTrue(data.Length > 0);
        }
示例#4
0
        public void TestGenerateTarGzNOMETAINF()
        {
            List <string> expect = new List <string> {
                "src/github.com/example_cc/example_cc.go"
            };

            string path = Path.Combine(SAMPLE_GO_CC, "/src/github.com/example_cc").Locate();

            byte[] bytes = Utils.GenerateTarGz(path, "src/github.com/", null);
            Assert.IsNotNull(bytes, "generateTarGz() returned null bytes.");
            List <string> tarBytesToEntryArrayList = TestUtils.TestUtils.TarBytesToEntryArrayList(bytes);

            CollectionAssert.AreEquivalent(expect, tarBytesToEntryArrayList, "Tar not what expected.");
        }
示例#5
0
        public void TestGenerateTarGzMETAINF()
        {
            List <string> expect = new List <string> {
                "META-INF/statedb/couchdb/indexes/MockFakeIndex.json", "src/github.com/example_cc/example_cc.go"
            };

            expect.Sort();
            string path    = Path.Combine(SAMPLE_GO_CC, "/src/github.com/example_cc").Locate();
            string metainf = "fixture/meta-infs/test1/META-INF".Locate();

            byte[] bytes = Utils.GenerateTarGz(path, "src/github.com/example_cc", metainf);
            Assert.IsNotNull(bytes, "generateTarGz() returned null bytes.");
            List <string> tarBytesToEntryArrayList = TestUtils.TestUtils.TarBytesToEntryArrayList(bytes);

            CollectionAssert.AreEquivalent(expect, tarBytesToEntryArrayList, "Tar not what expected.");
        }