Exemple #1
0
        public void GenerateFile()
        {
            AccordionStep taskListStep = new AccordionStep(1, "Task list in body");

            taskListStep.AddComponent(CreateCompleteComplexTask());
            taskListStep.AddComponent(CreateCompleteSimpleTask());
            taskListStep.AddComponent(CreateIncompleteTask());

            AccordionStep headersStep = new AccordionStep(2, "Headers in body");

            headersStep.AddComponent(new AccordionHeader(HeaderType.H1, new AccordionSimpleText("This is header")));
            headersStep.AddComponent(new AccordionHeader(HeaderType.H2, new AccordionSimpleText("This is header")));
            headersStep.AddComponent(new AccordionHeader(HeaderType.H6, new AccordionSimpleText("This is header")));

            AccordionStep linkStep = new AccordionStep(3, "Link(s) in body");

            linkStep.AddComponent(new AccordionSimpleText("Some text "));
            linkStep.AddComponent(new AccordionLink("name", "https://g23"));

            AccordionStep bulletStep = new AccordionStep(4, "Bullet in body");

            bulletStep.AddComponent(new AccordionBullet("My first bullet"));

            List <AccordionStep> steps = new List <AccordionStep>()
            {
                taskListStep,
                headersStep,
                linkStep,
                bulletStep
            };

            FileTutorial tutorial = new FileTutorial();

            tutorial.Add(steps);

            MDFileCreator fileCreator = new MDFileCreator();

            fileCreator.SaveInFile("newTutorial", tutorial);
        }
 public void SaveInFile(string fileName, Tutorial tutorial)
 {
     System.IO.File.WriteAllText($@"{Directory.GetCurrentDirectory()}\TestData\{fileName}.md", tutorial.ToString());
 }