public virtual void ShouldDecodeString()
        {
            var stringType = new StringType();
            var result     = stringType.Encode("MonkeyMediumSizeString");

            Assert.Equal("MonkeyMediumSizeString", stringType.Decode <string>(result));
        }
Exemplo n.º 2
0
 public virtual void ShouldDecodeLongString()
 {
     var stringType = new StringType();
     var longString = "MonkeyVeryLongStringmljalkdjflksjf lkdfjlsfjalkfjlsflskfjlsflsfjasdfjlsjflksfjlskjf fjlskfjlsjfs fkj lakdflsjfsa fafd sa";
     var result = stringType.Encode(longString);
     Assert.Equal(longString, stringType.Decode<string>(result));
 }
        public virtual void ShouldDecodeLongString()
        {
            var stringType = new StringType();
            var longString = "MonkeyVeryLongStringmljalkdjflksjf lkdfjlsfjalkfjlsflskfjlsflsfjasdfjlsjflksfjlskjf fjlskfjlsjfs fkj lakdflsjfsa fafd sa";
            var result     = stringType.Encode(longString);

            Assert.Equal(longString, stringType.Decode <string>(result));
        }
Exemplo n.º 4
0
        public virtual void ShouldEncodeString()
        {
            var monkeyEncoded =
                "00000000000000000000000000000000000000000000000000000000000000064d6f6e6b65790000000000000000000000000000000000000000000000000000";

            //0000000000000000000000000000000000000000000000000000000000000006 is the bytes length
            //4d6f6e6b65790000000000000000000000000000000000000000000000000000 Monkey byte array utf8 encoded
            
            var stringType = new StringType();
            var result = stringType.Encode("Monkey").ToHex();
            Assert.Equal(monkeyEncoded, result);
        }
        public virtual void ShouldEncodeString()
        {
            var monkeyEncoded =
                "00000000000000000000000000000000000000000000000000000000000000064d6f6e6b65790000000000000000000000000000000000000000000000000000";

            //0000000000000000000000000000000000000000000000000000000000000006 is the bytes length
            //4d6f6e6b65790000000000000000000000000000000000000000000000000000 Monkey byte array utf8 encoded

            var stringType = new StringType();
            var result     = stringType.Encode("Monkey").ToHex();

            Assert.Equal(monkeyEncoded, result);
        }
Exemplo n.º 6
0
        public void StringEncode()
        {
            StringType type = new StringType();

            Assert.NotNull(type);
            Assert.True(type.Size == -1);

            // test the encoiding
            byte[] data = type.Encode("Hello");
            Assert.AreEqual(data[0], 72);
            Assert.AreEqual(data[1], 101);
            Assert.AreEqual(data[2], 108);
            Assert.AreEqual(data[3], 108);
            Assert.AreEqual(data[4], 111);
        }
Exemplo n.º 7
0
 public virtual void ShouldDecodeString()
 {
     var stringType = new StringType();
     var result = stringType.Encode("MonkeyMediumSizeString");
     Assert.Equal("MonkeyMediumSizeString", stringType.Decode<string>(result));
 }