예제 #1
0
        public void Test_bytes_invalid_length(AbiEncodingStyle encodingStyle)
        {
            AbiType type = new AbiBytes(19);

            byte[]       data      = new byte[23];
            AbiSignature signature = new AbiSignature("abc", type);

            Assert.Throws <AbiException>(() => _abiEncoder.Encode(encodingStyle, signature, data));
        }
예제 #2
0
        public void Test_bytes(AbiEncodingStyle encodingStyle)
        {
            AbiType type = new AbiBytes(19);

            byte[]       data      = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 };
            AbiSignature signature = new AbiSignature("abc", type);

            byte[]   encoded   = _abiEncoder.Encode(encodingStyle, signature, data);
            object[] arguments = _abiEncoder.Decode(encodingStyle, signature, encoded);
            Assert.True(Bytes.AreEqual((byte[])arguments[0], data));
        }