public void Allocate_Write_Read_TwoPages() { var path = Path.GetTempFileName(); if (File.Exists(path)) File.Delete(path); using (var file = new CompoundFile(path)) { var ix = file.Allocate(); var data = new byte[6000]; for (int i = 0; i < 6000; i++) data[i] = (byte)(i % 255); file.Write(ix, data, 0, 6000); var readdata = file.ReadAll(ix); for(int i=0;i<6000;i++) Assert.AreEqual(data[i], readdata[i]); } if (File.Exists(path)) File.Delete(path); }
public void Allocate_Write_Read_SinglePage() { var path = Path.GetTempFileName(); if (File.Exists(path)) File.Delete(path); using (var file = new CompoundFile(path)) { var ix = file.Allocate(); var data = new byte[255]; for (byte i = 0; i < 255; i++) data[i] = i; file.Write(ix, data, 0, 255); var readData = file.ReadAll(ix); for(byte i=0;i<255;i++) Assert.AreEqual(data[i], readData[i]); } if (File.Exists(path)) File.Delete(path); }