public void CanSerializeAndDeserializeXML()
        {
            var obj = new FieldDefinition();
            var service = new DefaultXMLSerializationService();

            var strValue = service.Serialize(obj);
            service.Deserialize(obj.GetType(), strValue);
        }
Пример #2
0
        public void Create_BuildBaseline()
        {
            var assemblies = new List<Assembly>();

            // SPMeta2
            // SPMeta2.Standard
            assemblies.Add(typeof(FieldDefinition).Assembly);
            assemblies.Add(typeof(TaxonomyFieldDefinition).Assembly);

            // SPMeta2.CSOM
            // SPMeta2.CSOM.Standard
            assemblies.Add(typeof(SPMeta2.CSOM.ModelHandlers.FieldModelHandler).Assembly);
            assemblies.Add(typeof(SPMeta2.CSOM.Standard.ModelHandlers.Fields.TaxonomyFieldModelHandler).Assembly);

            // SPMeta2.SSOM
            // SPMeta2.SSOM.Standard
            assemblies.Add(typeof(SPMeta2.SSOM.ModelHandlers.FieldModelHandler).Assembly);
            assemblies.Add(typeof(SPMeta2.SSOM.Standard.ModelHandlers.Fields.TaxonomyFieldModelHandler).Assembly);

            var result = new List<BuildBaseline>();

            foreach (var assembly in assemblies)
            {
                result.Add(BuildBaselineFromAssembly(assembly));
            }

            var fileName = "m2.buildbaseline.xml";

            var xmlService = new DefaultXMLSerializationService();
            xmlService.RegisterKnownType(typeof(BuildBaseline));

            var content = xmlService.Serialize(result);

            Trace.WriteLine(content);

            var paths = new[]
            {
                fileName,
                "../../../SPMeta2.Build/" + fileName
            };

            foreach (var path in paths)
                System.IO.File.WriteAllText(path, content);
        }