public void CanHandleDomainObjectWithJsonFormatter() { using (Stream _formattedTemplate = new FileStream(this._provisioningTemplatePath7, FileMode.Open, FileAccess.Read, FileShare.Read)) { ITemplateFormatter formatter = new JsonPnPFormatter(); JsonTemplateProvider provider = new JsonFileSystemTemplateProvider( String.Format(@"{0}\..\..\Resources", AppDomain.CurrentDomain.BaseDirectory), "Templates"); formatter.Initialize(provider); var _pt = formatter.ToProvisioningTemplate(_formattedTemplate, "WORKFLOWSITE"); var _formattedTemplateBack = formatter.ToFormattedTemplate(_pt); Assert.IsNotNull(_formattedTemplateBack); } }
public void CanSerializeDomainObjectWithJsonFormatter() { using (Stream _formattedTemplate = new FileStream(this._provisioningTemplatePath8, FileMode.Open, FileAccess.Read, FileShare.Read)) { ITemplateFormatter formatter = XMLPnPSchemaFormatter.GetSpecificFormatter(this._provisioningTemplatePath8NamespaceURI); XMLTemplateProvider xmlProvider = new XMLFileSystemTemplateProvider( String.Format(@"{0}\..\..\Resources", AppDomain.CurrentDomain.BaseDirectory), "Templates"); formatter.Initialize(xmlProvider); var _pt = formatter.ToProvisioningTemplate(_formattedTemplate, "WORKFLOWSITE"); JsonTemplateProvider jsonProvider = new JsonFileSystemTemplateProvider( String.Format(@"{0}\..\..\Resources", AppDomain.CurrentDomain.BaseDirectory), "Templates"); jsonProvider.SaveAs(_pt, @"c:\temp\ProvisioningSchema-2015-12-FullSample-02.json"); var _ptBack = jsonProvider.GetTemplate(@"c:\temp\ProvisioningSchema-2015-12-FullSample-02.json"); Assert.IsTrue(_pt.Equals(_ptBack)); } }