public void Underlines_FromFirstToLastModifierUnit_IncludingAllUnitsInBetween( string unShuffledSentence) { Paragraph paragraph = DocumentContentHelper .GetParagraphFromWordDocument(unShuffledSentence); var modifierStrategy = new ModifierStrategy(new FakeModifierFormatter()); // act var shufflerParagraph = modifierStrategy.ShuffleSentenceUnit(paragraph); // assert Text[] sentenceArray = shufflerParagraph.Descendants <Text>().ToArray(); int firstModifierPosition = Array.FindIndex( sentenceArray, text => text.InnerText.StartsWith("MD")); int lastModifierPosition = Array.FindLastIndex( sentenceArray, text => text.InnerText == "MD") + 1; for (int index = 0; index < sentenceArray.Length; index++) { Text t = sentenceArray[index]; if (index >= firstModifierPosition && index <= lastModifierPosition) { Assert.That(t.Parent.InnerXml.Contains("<w:u w:val=\"single\" />")); } } }
private static void AssertReturnIsEqualToExpected( string input, string expected, IModifierFormatter modifierFormatter) { Paragraph paragraph = DocumentContentHelper.GetParagraphFromWordDocument(input); var modifierUnitStrategy = new ModifierStrategy(modifierFormatter); // act var shuffledParagraph = modifierUnitStrategy.ShuffleSentenceUnit(paragraph); Assert.That(shuffledParagraph.InnerText, Is.EqualTo( expected)); }