Пример #1
0
        public void GZipMemberEntry_GetAllMemberEntriesFromFile_GetsMembersWithExpectedEntryNames(TestResource testResource)
        {
            IEnumerable <GZipMemberEntry> entries = null;
            string testResourcePath;

            using (testResource.ExtractToTemporaryFile(out testResourcePath))
                using (var stream = new FileStream(testResourcePath, FileMode.Open, FileAccess.Read))
                {
                    entries = GZipMemberEntry.GetMemberEntries(stream);
                }

            // .cfg file CRCs are zero because they are inconsistent based on line endings.
            // .luigi file CRCs are zero merely because they haven't been computed :P
            var expectedCrc32s = new[] { TestRomResources.TestBinCrc, 0u, 0u, TestRomResources.TestRomCrc };
            var expectedNames  = testResource.ArchiveContents.ToList();
            var i = 0;

            foreach (var entry in entries)
            {
                // Expected length is loosely checked -- any value indicates a > 0 check.
                VerifyGZipMemberEntry(entry, expectedNames[i], expectedCrc32s[i], expectedLength: 2, checkModificationDate: false, checkOffset: i > 0);
                ++i;
            }
        }