public void WriteSegment_SegmentWithData() { var output = new MemoryStream(); var writer = new JpegSegmentWriter(new BinaryWriter(output)); var segment = new JpegSegment(JpegSegmentType.App1, new byte[] { 0x12, 0x34, 0x56 }, 0); writer.WriteSegment(segment); var result = output.ToArray(); CollectionAssert.AreEqual( new byte[] { 0xFF, 0xE1, 0x00, 0x05, 0x12, 0x34, 0x56 }, result); }
public void WriteSegment_SegmentWithoutData() { var output = new MemoryStream(); var writer = new JpegSegmentWriter(new BinaryWriter(output)); var segment = new JpegSegment(JpegSegmentType.Soi, new byte[0], 0); writer.WriteSegment(segment); var result = output.ToArray(); CollectionAssert.AreEqual( new byte[] { 0xFF, 0xD8 }, result); }