Ejemplo n.º 1
0
        public void TestReadInvalidFileHeader()
        {
            var shortData = new byte[] { 0x70, 0x00, 0x61, 0x00, 0x74, 0x00, 0x68, 0x00, 0x2F, 0x00, 0x74, 0x00, 0x6F, 0x00, 0x2F, 0x00, 0x66, 0x00, 0x69, 0x00 };
            var exception = Assert.Throws <AnnoRDA.FileFormatException>(() => {
                using (var reader = new ContainerFileLoaderStructureReader(TestData.GetReader(shortData), false)) {
                    reader.ReadFileHeader();
                }
            });

            Assert.Equal(new AnnoRDA.FileFormatException(AnnoRDA.FileFormatException.EntityType.FileHeader, AnnoRDA.FileFormatException.Error.UnexpectedEndOfFile, 20), exception);
        }
Ejemplo n.º 2
0
        public void TestReadFileHeader()
        {
            AnnoRDA.FileEntities.FileHeader actual;
            using (var reader = new ContainerFileLoaderStructureReader(TestData.GetReader("FileHeaders/2.2_file_header.bin"), false)) {
                actual = reader.ReadFileHeader();
            }
            var expected = new AnnoRDA.FileEntities.FileHeader()
            {
                Path                  = "path/to/file.txt",
                DataOffset            = 11111111,
                CompressedFileSize    = 36960,
                UncompressedFileSize  = 36960,
                ModificationTimestamp = 1448398881,
            };

            Assert.Equal(expected, actual);
        }