private static void VerifyFile(PackFile packfile, string filename, byte[] expected, string id) { // See that it exists Assert.IsTrue(packfile.FileExists(filename), string.Format("{0} doesn't exist ({1})", filename, id)); // See that the length is ok Assert.AreEqual(expected.Length, packfile.FileLength(filename), string.Format("{0} has bad length (FileLength, {1})", filename, id)); // Test GetFileRaw int len; byte[] data = packfile.GetFileRaw(filename, out len); Assert.AreEqual(expected.Length, packfile.FileLength(filename), string.Format("{0} has bad length (GetFileRaw, {1})", filename, id)); Assert.IsTrue(Compare(data, expected), string.Format("{0} has data mismatch (GetFileRaw, {1})", filename, id)); // Test GetFile Stream strm = packfile.GetFile(filename, out len); Assert.AreEqual(expected.Length, packfile.FileLength(filename), string.Format("{0} has bad length (GetFile, {1})", filename, id)); data = new byte[len]; strm.Read(data, 0, len); strm.Close(); Assert.IsTrue(Compare(data, expected), string.Format("{0} has data mismatch (GetFile, {1})", filename, id)); }