public void writeTemplates(IContentFormat contentFormatplugin) { if(contentFormatplugin.cmsBlockFactory.cmsBlocks.Count() > 0) { foreach(CMSBlock currentCMSBlock in contentFormatplugin.cmsBlockFactory.cmsBlocks) { this.htmlTemplatePath = Path.Combine(contentFormatplugin.currentWorkingDirectory ) + currentCMSBlock.Name + templateSuffix + templateExtension; try { string currentTemplate = File.ReadAllText(htmlTemplatePath); foreach(ContentPieces currentContentPiece in currentCMSBlock.Language.ContentPieces) { currentTemplate = currentTemplate.Replace("%%" + currentContentPiece.SectionName + "%%", currentContentPiece.SectionContent); } currentTemplate = currentTemplate.Replace("%%language-code%%", currentCMSBlock.Language.Name); string destinationFile = Path.Combine(contentFormatplugin.currentWorkingDirectory) + currentCMSBlock.Language.Name + "-" + currentCMSBlock.Name + templateExtension; File.WriteAllText(destinationFile, currentTemplate); } catch(Exception exception) { Console.WriteLine("Error - " + exception.ToString()); } } } }
public void SetUp() { service = Substitute.For <IService>(); service .GetContent(Identity) .Returns(TestContent); format = Substitute.For <IContentFormat>(); format .Format(Arg.Any <string>()) .Returns(TestContentFormatted); client = new Client(service, format); }
public Client(IService service, IContentFormat format) : this(service) { this.format = format; }