Exemple #1
0
        public void Serialize()
        {
            FunctionCode code;
            bool         hasStorage;
            string       name;
            string       codeVersion;
            string       author;
            string       email;
            string       description;

            setupContractStateWithValues(uut, out code, out hasStorage, out name, out codeVersion, out author, out email, out description);

            byte[] data;
            using (MemoryStream stream = new MemoryStream())
            {
                using (BinaryWriter writer = new BinaryWriter(stream, Encoding.ASCII, true))
                {
                    uut.Serialize(writer);
                    data = stream.ToArray();
                }
            }

            byte[] requiredData = new byte[] { 0, 32, 66, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 1, 0, 0, 1, 7, 110, 97, 109, 101, 83, 116, 114, 14, 99, 111, 100, 101, 86, 101, 114, 115, 105, 111, 110, 83, 116, 114, 9, 97, 117, 116, 104, 111, 114, 83, 116, 114, 8, 101, 109, 97, 105, 108, 83, 116, 114, 14, 100, 101, 115, 99, 114, 105, 112, 116, 105, 111, 110, 83, 116, 114 };

            data.Length.Should().Be(95);
            for (int i = 0; i < 95; i++)
            {
                data[i].Should().Be(requiredData[i]);
            }
        }