public void ExampleToString() { var example = new ExampleBlock(@"blah"); const string kExpectedOut = @"BEGIN EX blah END EX"; Assert.AreEqual(example.ToString(), kExpectedOut); }
public void ExampleModifiedTextToString() { var example = new ExampleBlock(@"blah"); example.Text = @"blah2"; const string kExpectedOut = @"BEGIN EX blah2 END EX"; Assert.AreEqual(example.ToString(), kExpectedOut); }
private XElement FormattedXML(MemberSubSection section) { var finalList = new List <XElement>(); var sigList = section.SignatureEntryList.Where(sig => sig.Asm != null).Select(sig => FormattedXML(sig.Asm)); finalList.AddRange(sigList); finalList.Add(new XElement("Summary", section.Summary)); if (section.Parameters != null && section.Parameters.Count > 0) { var paramsList = section.Parameters.Select(paramWithDoc => FormattedXML(paramWithDoc)); finalList.AddRange(paramsList); } if (section.ReturnDoc != null) { finalList.Add(FormattedXML(section.ReturnDoc)); } var blocks = new List <XElement>(); foreach (var block in section.TextBlocks) { XElement blockXML = new XElement("dummy"); DescriptionBlock descriptionBlock = block as DescriptionBlock; if (descriptionBlock != null) { blockXML = FormattedXML(descriptionBlock); } ExampleBlock exampleBlock = block as ExampleBlock; if (exampleBlock != null) { blockXML = FormattedXML(exampleBlock); } blocks.Add(blockXML); } finalList.AddRange(blocks); return(new XElement("Section", finalList)); }
private XElement FormattedXML(ExampleBlock block) { if (block.IsConvertExample) { var exampleList = new List <XElement>(); string javaScriptText = block.Text; string cSharpScriptText; string booScriptText; DoConversion(javaScriptText, out cSharpScriptText, out booScriptText); exampleList.Add(new XElement("JavaScript", new XCData(javaScriptText))); exampleList.Add(new XElement("CSharp", new XCData(cSharpScriptText))); exampleList.Add(new XElement("Boo", new XCData(booScriptText))); return(new XElement("Example", new XAttribute("nocheck", block.IsNoCheck), new XAttribute("convertexample", block.IsConvertExample), exampleList)); } return(new XElement("Example", new XAttribute("nocheck", block.IsNoCheck), new XAttribute("convertexample", block.IsConvertExample), new XCData(block.Text))); }