public void WriteMarker_WritesToPlacedPosition() { using var stream = new MemoryStream(); using (var writer = new TiffStreamWriter(stream)) { writer.Write(0x11111111); long marker = writer.PlaceMarker(); writer.Write(0x33333333); writer.WriteMarker(marker, 0x12345678); writer.Write(0x44444444); } Assert.Equal( new byte[] { 0x11, 0x11, 0x11, 0x11, 0x78, 0x56, 0x34, 0x12, 0x33, 0x33, 0x33, 0x33, 0x44, 0x44, 0x44, 0x44 }, stream.ToArray()); }
public void Position_EqualsTheStreamPosition(byte[] data, long expectedResult) { using var stream = new MemoryStream(); using var writer = new TiffStreamWriter(stream); writer.Write(data); Assert.Equal(writer.Position, expectedResult); }
public void Write_WritesUInt32() { using var stream = new MemoryStream(); using var writer = new TiffStreamWriter(stream); writer.Write(12345678U); Assert.Equal(new byte[] { 0x4E, 0x61, 0xBC, 0x00 }, stream.ToArray()); }
public void Write_WritesUInt16() { using var stream = new MemoryStream(); using var writer = new TiffStreamWriter(stream); writer.Write(1234); Assert.Equal(new byte[] { 0xD2, 0x04 }, stream.ToArray()); }
public void Write_WritesByteArray() { using var stream = new MemoryStream(); using var writer = new TiffStreamWriter(stream); writer.Write(new byte[] { 2, 4, 6, 8 }); Assert.Equal(new byte[] { 2, 4, 6, 8 }, stream.ToArray()); }