private static void EqualClassifiedTextRun(ClassifiedTextRun expected, ClassifiedTextRun actual) { Assert.Equal(expected.ClassificationTypeName, actual.ClassificationTypeName); Assert.Equal(expected.Text, actual.Text); Assert.Equal(expected.Tooltip, actual.Tooltip); Assert.Equal(expected.Style, actual.Style); if (expected.NavigationAction is null) { Assert.Equal(expected.NavigationAction, actual.NavigationAction); } else if (expected.NavigationAction.Target is QuickInfoHyperLink hyperLink) { Assert.Same(expected.NavigationAction, hyperLink.NavigationAction); var actualTarget = Assert.IsType <QuickInfoHyperLink>(actual.NavigationAction.Target); Assert.Same(actual.NavigationAction, actualTarget.NavigationAction); Assert.Equal(hyperLink, actualTarget); } else { // Cannot validate this navigation action Assert.NotNull(actual.NavigationAction); Assert.IsNotType <QuickInfoHyperLink>(actual.NavigationAction.Target); } }
internal static void AssertExpectedClassification( ClassifiedTextRun run, string expectedText, string expectedClassificationType, ClassifiedTextRunStyle expectedClassificationStyle = ClassifiedTextRunStyle.Plain) { Assert.Equal(expectedText, run.Text); Assert.Equal(expectedClassificationType, run.ClassificationTypeName); Assert.Equal(expectedClassificationStyle, run.Style); }
static bool VerifyRunMatches(ClassifiedTextRun run, string expectedClassificationType, string expectedText) { return(run.ClassificationTypeName == expectedClassificationType && run.Text == expectedText); }
void AssertTextAndClassification(ClassifiedTextRun run, string text, string classification = PredefinedClassificationTypeNames.NaturalLanguage) { Assert.AreEqual(text, run.Text); Assert.AreEqual(classification, run.ClassificationTypeName); }
static internal void addText(this List <ClassifiedTextRun> content, string kw) { var temp = new ClassifiedTextRun(PredefinedClassificationTypeNames.Identifier, kw); content.Add(temp); }
static internal void addWs(this List <ClassifiedTextRun> content) { var temp = new ClassifiedTextRun(PredefinedClassificationTypeNames.WhiteSpace, " "); content.Add(temp); }