public void Underlines_FromFirstToLastAdverbUnit_IncludingAllUnitsInBetween( string unShuffledSentence) { Paragraph paragraph = DocumentContentHelper.GetParagraphFromWordDocument(unShuffledSentence); var clauserUnitStrategy = new AdverbUnitStrategy(); // act var shufflerParagraph = clauserUnitStrategy.ShuffleSentenceUnit(paragraph); // assert Text[] sentenceArray = shufflerParagraph.Descendants <Text>().ToArray(); int firstAdverbPosition = Array.FindIndex( sentenceArray, text => text.InnerText == "ADV"); int lastAdverbPosition = Array.FindLastIndex( sentenceArray, text => text.InnerText == "ADV") + 1; for (int index = 0; index < sentenceArray.Length; index++) { Text t = sentenceArray[index]; if (index >= firstAdverbPosition && index <= lastAdverbPosition) { Assert.That(t.Parent.InnerXml.Contains("<w:u w:val=\"single\" />")); } } }
private static void AssertThatUnShuffledSentenceReturnsExpectedSentence(string unShuffledSentence, string expectedSentence) { Paragraph paragraph = DocumentContentHelper.GetParagraphFromWordDocument(unShuffledSentence); var clauserUnitStrategy = new AdverbUnitStrategy(); // act var shufflerParagraph = clauserUnitStrategy.ShuffleSentenceUnit(paragraph); // assert Assert.That(shufflerParagraph.InnerText, Is.EqualTo( expectedSentence)); }