Example #1
0
        public void TestMarshalPrimitiveMap()
        {
            XmlPrimitiveMapMarshaler marshaler = new XmlPrimitiveMapMarshaler();

            PrimitiveMap map = new PrimitiveMap();

            map.SetBool("boolean", true);
            map.SetByte("byte", (byte)1);
            map["bytes1"] = new byte[1];
            map.SetChar("char", 'a');
            map.SetDouble("double", 1.5);
            map.SetFloat("float", 1.5f);
            map.SetInt("int", 1);
            map.SetLong("long", 1);
            map["object"] = "stringObj";
            map.SetShort("short", (short)1);
            map.SetString("string", "string");

            byte[] result = marshaler.Marshal(map);
            Assert.IsNotNull(result);

            result = marshaler.Marshal(null);
            Assert.IsNull(result);
        }