Пример #1
0
        //////////////////////
        // VALUE CONVERSION //
        //////////////////////



        public Object ImportCustomValue(StructValue sv)
        {
            ImportExportHelper helper = sv.GetXType.GetImportExportHelper();

            if (helper == null)
            {
                return(null);
            }

            return(helper.ImportValue(sv));
        }
Пример #2
0
        private void Test(URL url)
        {
            XType         type       = new XType("url");
            Class2TypeMap class2type = new Class2TypeMap();

            URLSerializer.Init(type, class2type);
            ImportExportHelper helper = type.GetImportExportHelper();

            StructValue sv = helper.ExportValue(vf, url);

            Assert.AreEqual(sv.GetXType, type);

            URL url2 = (URL)helper.ImportValue(sv);

            Assert.AreEqual(url.ToString(), url2.ToString());
        }
Пример #3
0
        // no tests for null keys as string? isn't allowed

        public void TestMap(StrIntHashMap map)
        {
            XType type = new XType("map");

            Class2TypeMap class2type = new Class2TypeMap();

            StrIntHashMapSerializer.Init(type, class2type);
            ImportExportHelper helper = type.GetImportExportHelper();

            StructValue sv = helper.ExportValue(vf, map);

            Assert.AreEqual(sv.GetXType, type);

            StrIntHashMap map2 = (StrIntHashMap)helper.ImportValue(sv);

            Assert.AreEqual(map, map2);
        }
Пример #4
0
        private void TestDate(DateTime date)
        {
            XType type = new XType("date");

            Class2TypeMap class2type =
                new Class2TypeMap();

            DateSerializer.Init(type, class2type);

            ImportExportHelper helper = type.GetImportExportHelper();
            StructValue        sv     = helper.ExportValue(vf, date);

            Assert.AreEqual(sv.GetXType, type);

            DateTime date2 = ( DateTime )helper.ImportValue(sv);

            Assert.AreEqual(date, date2);
        }