public void GetParameterValue_StylesInfo() { string xmlStyleInfo = m_dataSource.GetParameterValue("StylesInfo"); StylePropsInfo styleInfo = (StylePropsInfo)ReflectionHelper.GetProperty( m_dataSource, "StyleInfo"); List <StyleInfo> sentenceInitialStyles = (List <StyleInfo>)ReflectionHelper.GetField( typeof(StylePropsInfo), "s_sentenceInitial"); List <StyleInfo> properNounStyles = (List <StyleInfo>)ReflectionHelper.GetField( typeof(StylePropsInfo), "s_properNoun"); List <StyleInfo> tableStyles = (List <StyleInfo>)ReflectionHelper.GetField( typeof(StylePropsInfo), "s_table"); List <StyleInfo> listStyles = (List <StyleInfo>)ReflectionHelper.GetField( typeof(StylePropsInfo), "s_list"); List <StyleInfo> specialStyles = (List <StyleInfo>)ReflectionHelper.GetField( typeof(StylePropsInfo), "s_special"); List <StyleInfo> titleStyles = (List <StyleInfo>)ReflectionHelper.GetField( typeof(StylePropsInfo), "s_title"); List <StyleInfo> headingStyles = (List <StyleInfo>)ReflectionHelper.GetField( typeof(StylePropsInfo), "s_heading"); Assert.AreEqual(20, sentenceInitialStyles.Count); Assert.AreEqual(1, properNounStyles.Count); Assert.AreEqual(5, tableStyles.Count); Assert.AreEqual(8, listStyles.Count); Assert.AreEqual(5, specialStyles.Count); Assert.AreEqual(3, titleStyles.Count); Assert.AreEqual(11, headingStyles.Count); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Gets the references where capitalization errors occurred. /// </summary> /// <param name="tokens">The Scripture tokens.</param> /// <returns>list of capitalization errors.</returns> /// ------------------------------------------------------------------------------------ public List <TextTokenSubstring> GetReferences(IEnumerable <ITextToken> tokens) { // m_SentenceFinalPunc = m_chkDataSource.GetParameterValue(kSentenceFinalPuncParameter); if (m_stylePropsInfo == null) { string styleInfo = m_chkDataSource.GetParameterValue(kStyleSheetInfoParameter); Debug.Assert(!string.IsNullOrEmpty(styleInfo), "Style information not provided."); m_stylePropsInfo = StylePropsInfo.Load(styleInfo); CreateCapitalStyleDictionary(); Debug.Assert(m_allCapitalizedStyles.Count > 0, "No styles require capitalization."); } CapitalizationProcessor bodyPuncProcessor = new CapitalizationProcessor(m_chkDataSource, m_allCapitalizedStyles); CapitalizationProcessor notePuncProcessor = new CapitalizationProcessor(m_chkDataSource, m_allCapitalizedStyles); notePuncProcessor.ProcessParagraphsSeparately = true; m_capitalizationErrors = new List <TextTokenSubstring>(); VerseTextToken scrTok = new VerseTextToken(); ITextToken tok; foreach (ITextToken token in tokens) { if (token.TextType == TextType.Note || token.TextType == TextType.PictureCaption) { tok = token; } else { // Make the token one of our special capitalization text tokens. scrTok.Token = token; tok = scrTok; } if (tok.TextType == TextType.Note) { notePuncProcessor.ProcessToken(tok, m_capitalizationErrors); } else if (tok.TextType == TextType.Verse || tok.TextType == TextType.Other) { bodyPuncProcessor.ProcessToken(tok, m_capitalizationErrors); } } return(m_capitalizationErrors); }