Пример #1
0
        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");
            }
        }
Пример #2
0
        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");
            }
        }