Ejemplo n.º 1
0
        public void SingleFileInTreeTest()
        {
            var file = new System.IO.FileInfo(Path.Combine(Path.GetTempPath(), "objects", "08", Path.GetRandomFileName()));

            if (!file.Directory.Exists)
            {
                file.Directory.Create();
            }

            File.WriteAllBytes(file.FullName, TestResources.singlefiletree);

            try
            {
                var result = ObjectFileParser.ParseFile(file);
                StringAssert.Contains(result.Body, "test.txt");
                StringAssert.Contains(result.Body, "d0f89fe97552ddd9cefcab879175436503bc9251");
            }
            finally
            {
                file.Delete();
            }
        }
Ejemplo n.º 2
0
        public void DecodeTest()
        {
            var file = new System.IO.FileInfo(Path.Combine(Path.GetTempPath(), "objects", "08", Path.GetRandomFileName()));

            if (!file.Directory.Exists)
            {
                file.Directory.Create();
            }

            File.WriteAllBytes(file.FullName, TestResources.multifiletree);

            try
            {
                var result = ObjectFileParser.ParseFile(file);
                StringAssert.Contains(result.Body, "b39e4ee91acfd62f10b9b931daed0b0344a438b1");
                StringAssert.Contains(result.Body, "12c4cf90fa0e83fa111446ef4fedf2fc37e4ebc1");
                StringAssert.Contains(result.Body, "test.txt");
                StringAssert.Contains(result.Body, "nog een file.txt");
            }
            finally
            {
                file.Delete();
            }
        }