private List <Localization> LoadContentTypes(Core.Framework.Provisioning.Model.ContentTypeCollection coll) { List <Localization> loc = new List <Localization>(); foreach (Core.Framework.Provisioning.Model.ContentType item in coll) { loc.Add(new Localization(item.Id, item.Name, item.Description)); } return(loc); }
public bool ValidateContentTypes(Core.Framework.Provisioning.Model.ContentTypeCollection sElements, Core.Framework.Provisioning.Model.ContentTypeCollection tElements, TokenParser sParser, TokenParser tParser) { List <Localization> sColl = LoadContentTypes(sElements); List <Localization> tColl = LoadContentTypes(tElements); if (sColl.Count > 0) { if (!Validatelocalization(sColl, tColl, sParser, tParser)) { return(false); } } return(true); }
public bool Validate(Core.Framework.Provisioning.Model.ContentTypeCollection sourceCollection, Core.Framework.Provisioning.Model.ContentTypeCollection targetCollection, TokenParser tokenParser) { // Convert object collections to XML List <SerializedContentType> sourceContentTypes = new List <SerializedContentType>(); List <SerializedContentType> targetContentTypes = new List <SerializedContentType>(); foreach (Core.Framework.Provisioning.Model.ContentType ct in sourceCollection) { ProvisioningTemplate pt = new ProvisioningTemplate(); pt.ContentTypes.Add(ct); sourceContentTypes.Add(new SerializedContentType() { SchemaXml = ExtractElementXml(pt) }); } foreach (Core.Framework.Provisioning.Model.ContentType ct in targetCollection) { ProvisioningTemplate pt = new ProvisioningTemplate(); pt.ContentTypes.Add(ct); targetContentTypes.Add(new SerializedContentType() { SchemaXml = ExtractElementXml(pt) }); } // Use XML validation logic to compare source and target Dictionary <string, string[]> parserSettings = new Dictionary <string, string[]>(); parserSettings.Add("SchemaXml", null); bool isContentTypeMatch = ValidateObjectsXML(sourceContentTypes, targetContentTypes, "SchemaXml", new List <string> { "ID" }, tokenParser, parserSettings); Console.WriteLine("-- Content type validation " + isContentTypeMatch); return(isContentTypeMatch); }