Esempio n. 1
0
        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");
        }
Esempio n. 2
0
        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");
        }
Esempio n. 3
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");
            }
        }
Esempio n. 4
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");
            }
        }
Esempio n. 5
0
        public void TestWriteAddressExtendedSegmentAddressTooLarge()
        {
            var intelHexWriter = new IntelHexWriter(new MemoryStream());

            intelHexWriter.WriteAddress(AddressType.ExtendedSegmentAddress, 0x10000);
        }