public void CreateDisk_WithTwoFiles_DiskIsCreated() { using (MemoryStream stream = new MemoryStream()) { MemoryStream abc = new MemoryStream(); abc.WriteByte(0x01); abc.WriteByte(0x02); abc.WriteByte(0x03); MemoryStream def = new MemoryStream(); def.WriteByte(0x04); def.WriteByte(0x05); def.WriteByte(0x06); abc.Seek(0, SeekOrigin.Begin); def.Seek(0, SeekOrigin.Begin); Dictionary <string, Stream> files = new Dictionary <string, Stream>(); files.Add("Abc", abc); files.Add("Def", def); Rofs.CreateDisk(stream, files); stream.Seek(0, SeekOrigin.Begin); disk.Seek(0, SeekOrigin.Begin); Assert.AreEqual(disk.Length, stream.Length); for (int i = 0; i < disk.Length; i++) { Assert.AreEqual(disk.ReadByte(), stream.ReadByte(), "Bytes at " + i + " are different."); } } }
public static void Build(Stream destinationStrm, Dictionary <string, Stream> files) { Rofs.CreateDisk(destinationStrm, files); }