protected void VerifyFile(FileSystem fs, int num, int size, byte testdata) { var readFile = fs.ReadFile("TEST" + num.ToString() + ".DAT", false); Assert.AreEqual(size, readFile.Length, "Read file length wrong"); for (int i = 0; i < size; i++) { if (readFile[i] != testdata) Assert.Fail(string.Format("Data comparision failed, FileSize: {0} Byte: {1}, Expected: {2}, Found: {3}", size, i, testdata, readFile[i])); } }
protected void TestFile(FileSystem fs, int size) { var data = new byte[size]; for (int i = 0; i < size; i++) data[i] = (byte)(i & 0xFF); fs.AddFile("TESTFILE.DAT", data); var readFile = fs.ReadFile("TESTFILE.DAT", false); Assert.AreEqual(data.Length, readFile.Length, "Read file length wrong"); for (int i = 0; i < size; i++) { if (readFile[i] != data[i]) Assert.Fail(string.Format("Data comparision failed, FileSize: {0} Byte: {1}, Expected: {2}, Found: {3}", size, i, data[i], readFile[i])); } var info = fs.GetFileInfo("TESTFILE.DAT"); if (!fs.IsFileValid("TESTFILE.DAT", null)) Assert.Fail("File has errors"); }