Example #1
0
        public void Convert(string sourceFilePath, string targetFolderPath)
        {
            if (string.IsNullOrWhiteSpace(sourceFilePath))
            {
                throw new ArgumentNullException(sourceFilePath);
            }
            if (Path.GetExtension(sourceFilePath) != ".xml")
            {
                throw new FormatException();
            }
            if (string.IsNullOrWhiteSpace(targetFolderPath))
            {
                throw new ArgumentNullException(targetFolderPath);
            }

            var xmlContent = fileSystem.Read(sourceFilePath);

            if (string.IsNullOrWhiteSpace(xmlContent))
            {
                fileSystem.RemoveAll(targetFolderPath);
                return;
            }

            var mdFilesInformation = xml2MdConverter.Convert(xmlContent);

            if (mdFilesInformation == null || mdFilesInformation.Count == 0)
            {
                fileSystem.RemoveAll(targetFolderPath);
                return;
            }

            foreach (var mdFile in mdFilesInformation)
            {
                var targetFilePath = string.Format("{0}\\{1}.md", targetFolderPath, mdFile.FileName);

                ExportMdFiles(mdFile, targetFilePath);
            }
        }
        public void Code_tagi_md_formatina_cevrilir()
        {
            //arrange
            var codeContent = "string";
            var xmlContent  = GenerateXml(
                GenerateMember(
                    "T:System.Password",
                    GenerateCode(codeContent)
                    ),
                GenerateMember("M:Multinet.Framework.Logging.ILogger.Debug(System.Object)",
                               GenerateCode(codeContent)

                               ));

            //act
            var actual = testing.Convert(xmlContent);

            //assert
            Assert.IsTrue(actual[0].Content.Contains(string.Format("`{0}`", codeContent)));
        }
        public void Xml_icerigi_parse_edilemez_ise_hata_atilir()
        {
            const string xmlContent = "<doc><members><member></members></member></doc>";

            Assert.Throws <FormatException>(() => testing.Convert(xmlContent));
        }