public void ShortStream() { var data = new byte[ProgramHeader.Size - 1]; var reader = new BinaryReader(new MemoryStream(data)); Assert.IsFalse(ProgramHeader.TryRead(reader, out ProgramHeader h)); }
public void OtherSegment() { var data = TestData.GetProgramHeaderBytes( (ProgramHeader.Type) byte.MaxValue, expectedOffset, expectedVaddr, expectedSize); var reader = new BinaryReader(new MemoryStream(data)); Assert.IsTrue(ProgramHeader.TryRead(reader, out ProgramHeader h)); Assert.AreEqual(expectedOffset, h.OffsetInFile); Assert.AreEqual(expectedVaddr, h.VirtualAddress); Assert.AreEqual(expectedSize, h.SizeInFile); Assert.AreEqual(ProgramHeader.Type.Other, h.HeaderType); }
public void EmptyStream() { var emptyReader = new BinaryReader(new MemoryStream()); Assert.IsFalse(ProgramHeader.TryRead(emptyReader, out ProgramHeader h)); }