public void TestWriteDataTooLong() { var intelHexWriter = new IntelHexWriter(new MemoryStream()); Action act = () => intelHexWriter.WriteData(0, new byte[258].ToList()); act.ShouldThrow <ArgumentOutOfRangeException>().WithMessage("Must be less than 255\r\nParameter name: data"); }
public void TestWriteDataNull() { var intelHexWriter = new IntelHexWriter(new MemoryStream()); Action act = () => intelHexWriter.WriteData(0, new byte[258].ToList()); act.ShouldThrow <ArgumentOutOfRangeException>().And.ParamName.Should().Be("data"); }
private static void TestAddressWrite(AddressType addressType, uint address, string expected) { var ms = new MemoryStream(); var intelHexWriter = new IntelHexWriter(ms); intelHexWriter.WriteAddress(addressType, address); intelHexWriter.Close(); ms.Position = 0; using (var sr = new StreamReader(ms)) { sr.ReadLine().Should().Be(expected); sr.ReadLine().Should().Be(":00000001FF"); } }
public void TestWriteDataOk() { var ms = new MemoryStream(); var intelHexWriter = new IntelHexWriter(ms); intelHexWriter.WriteData(0x55AA, new byte[16].ToList()); intelHexWriter.Close(); ms.Position = 0; using (var sr = new StreamReader(ms)) { sr.ReadLine().Should().Be(":1055AA0000000000000000000000000000000000F1"); sr.ReadLine().Should().Be(":00000001FF"); } }
public void TestWriteAddressExtendedSegmentAddressTooLarge() { var intelHexWriter = new IntelHexWriter(new MemoryStream()); intelHexWriter.WriteAddress(AddressType.ExtendedSegmentAddress, 0x10000); }