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"); }
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 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"); } }