protected static void assertBATCount(NPOIFSFileSystem fs, int expectedBAT, int expectedXBAT) { int foundBAT = 0; int foundXBAT = 0; int sz = (int)(fs.Size / fs.GetBigBlockSize()); for (int i = 0; i < sz; i++) { if (fs.GetNextBlock(i) == POIFSConstants.FAT_SECTOR_BLOCK) { foundBAT++; } if (fs.GetNextBlock(i) == POIFSConstants.DIFAT_SECTOR_BLOCK) { foundXBAT++; } } Assert.AreEqual(expectedBAT, foundBAT, "Wrong number of BATs"); Assert.AreEqual(expectedXBAT, foundXBAT, "Wrong number of XBATs with " + expectedBAT + " BATs"); }