Exemplo n.º 1
0
        public void NefsHeaderPart4_MultipleItems_EntriesPopulated()
        {
            var p4 = new NefsHeaderPart4(this.testItems);

            // Dir 1 and file 4 should not have entries. Only compressed files have entries in part 4.
            Assert.Equal(3, p4.EntriesByIndex.Count);

            // Total size is (total number of chunks * bytes)
            Assert.Equal(36U, p4.Size);

            // File 1
            var f1Idx = p4.GetIndexForItem(this.file1);

            Assert.Equal(1U, p4.EntriesByIndex[f1Idx].ChunkSizes[0]);
            Assert.Equal(11U, p4.EntriesByIndex[f1Idx].ChunkSizes[1]);
            Assert.Equal(21U, p4.EntriesByIndex[f1Idx].ChunkSizes[2]);
            Assert.Equal(3, p4.EntriesByIndex[f1Idx].ChunkSizes.Count);

            // File 2
            var f2Idx = p4.GetIndexForItem(this.file2);

            Assert.Equal(2U, p4.EntriesByIndex[f2Idx].ChunkSizes[0]);
            Assert.Equal(22U, p4.EntriesByIndex[f2Idx].ChunkSizes[1]);
            Assert.Equal(52U, p4.EntriesByIndex[f2Idx].ChunkSizes[2]);
            Assert.Equal(3, p4.EntriesByIndex[f2Idx].ChunkSizes.Count);

            // File 3
            var f3Idx = p4.GetIndexForItem(this.file3);

            Assert.Equal(3U, p4.EntriesByIndex[f3Idx].ChunkSizes[0]);
            Assert.Equal(13U, p4.EntriesByIndex[f3Idx].ChunkSizes[1]);
            Assert.Equal(23U, p4.EntriesByIndex[f3Idx].ChunkSizes[2]);
            Assert.Equal(3, p4.EntriesByIndex[f3Idx].ChunkSizes.Count);
        }
Exemplo n.º 2
0
        public void GetIndexForItem_ItemIsValue_IndexReturned()
        {
            var p4 = new NefsHeaderPart4(this.testItems);

            Assert.Equal(0U, p4.GetIndexForItem(this.file1));
            Assert.Equal(3U, p4.GetIndexForItem(this.file2));
            Assert.Equal(6U, p4.GetIndexForItem(this.file3));
        }
Exemplo n.º 3
0
        public void GetIndexForItem_ItemIsUncompressed_NegativeOneReturned()
        {
            var p4 = new NefsHeaderPart4(this.testItems);

            Assert.Equal(0xFFFFFFFFU, p4.GetIndexForItem(this.file4NotCompressed));
        }
Exemplo n.º 4
0
        public void GetIndexForItem_ItemIsDirectory_ZeroReturned()
        {
            var p4 = new NefsHeaderPart4(this.testItems);

            Assert.Equal(0U, p4.GetIndexForItem(this.dir1));
        }