public void ConvertTextWithTrailingPeriod() { var md = "Text text."; var result = AlexaMarkdownToPlaintextRenderer.Render(md); Assert.Equal(md, result); }
private string NormalizeActivityText(string textFormat, string text) { if (string.IsNullOrWhiteSpace(text)) { return(string.Empty); } // Default to markdown if it isn't specified. if (textFormat == null) { textFormat = TextFormatTypes.Markdown; } string plainText; if (textFormat.Equals(TextFormatTypes.Plain, StringComparison.Ordinal)) { plainText = text; } else if (textFormat.Equals(TextFormatTypes.Markdown, StringComparison.Ordinal)) { plainText = AlexaMarkdownToPlaintextRenderer.Render(text); } else // xml format or other unknown and unsupported format. { plainText = string.Empty; } if (!SecurityElement.IsValidText(plainText)) { plainText = SecurityElement.Escape(plainText); } return(plainText); }
public void ConvertQuotesAndUrls() { var md = "{ \"contentType\": \"image/jpeg\", \"content\": \"https://somefantasticurl/\", \"name\": \"Attachment1.jpg\" }"; var result = AlexaMarkdownToPlaintextRenderer.Render(md); Assert.Equal("{ \"contentType\": \"image/jpeg\", \"content\": \"https://somefantasticurl/\", \"name\": \"Attachment1.jpg\" }.", result); }
public void ConvertTextBrAndParagraphsNoSpacesBetween() { var md = "Same line.\nSame line.\n2nd line.\n\r3rd line."; var result = AlexaMarkdownToPlaintextRenderer.Render(md); Assert.Equal("Same line. Same line. 2nd line. 3rd line.", result); }
public void ConvertTextNoTrailingNewline() { var md = "Text text"; var result = AlexaMarkdownToPlaintextRenderer.Render(md); Assert.Equal("Text text.", result); }
public void ConvertTextLeadingTrailingWhitespace() { var md = " Text text "; var result = AlexaMarkdownToPlaintextRenderer.Render(md); Assert.Equal("Text text.", result); }
public void ConvertTextWithNoTrailingPeriod() { var md = "Text text"; var result = AlexaMarkdownToPlaintextRenderer.Render(md); // Trailing period is added because it is a paragraph. Alexa TTS doesn't mind either way. Assert.Equal("Text text.", result); }