C# Class SIL.FieldWorks.FDO.FDOTests.FdoTestHelper

Various helper functions for testing FDO code
Show file Open project: sillsdev/FieldWorks Class Usage Examples

Public Methods

Method Description
CreateAnalyses ( ISegment segment, ITsString paraContents, int ichBeginOffset, int ichLimOffset ) : void

Creates analyses for the words and punctuation forms of the specified segment. Words will have WfiWordforms and glosses created if they don't already exist.

CreateAnalyses ( ISegment segment, ITsString paraContents, int ichBeginOffset, int ichLimOffset, bool fCreateGlosses ) : void

Creates analyses for the words and punctuation forms of the specified segment. Words will have WfiWordforms created if they don't already exist.

SetupStaticFdoProperties ( ) : void

Setup static FDO properties

VerifyAnalysis ( ISegment seg, int iSeg, IEnumerable expectedFormsWithoutAnalyses, IEnumerable expectedWordforms ) : void

Verifies the analysis for the given segment.

VerifyBtFootnote ( IStFootnote footnote, IStTxtPara para, int ws, int ich ) : void

Make sure the marker for a footnote exists in the back translation and refers to the footnote properly.

VerifyFootnote ( IStFootnote footnote, IStTxtPara para, int ich ) : void

Make sure footnote exists and is referred to properly in the paragraph contents

VerifyFootnoteInSegmentFt ( IStFootnote footnote, IStTxtPara para, int iSeg, int ws, int ich ) : void

Make sure the marker for the specified footnote exists in the free translation of the specified segment in the specified paragraph at the specified character position.

VerifyHyperlinkPropsAreCorrect ( ITsTextProps props, int expectedWs, string sUrl ) : void

Asserts the properties of a run are set correctly to be a hyperlink for the given URL.

Private Methods

Method Description
CreateAnalysisForWord ( string word, ISegment segment, int ws, bool fCreateGlosses ) : void
CreatePuncForm ( ISegment segment, ITsString form ) : void

Creates the requested punctuation form and adds it to the segment's analyses.

ParseSegBaseline ( ISegment seg, int ichBeginOffset, int ichLimOffset, Func handleWord, int>.Action handlePunc, int>.Action handleORC ) : int

Parses the given segment, calling the correct handler for each word and punctuation token found.

VerifyPunctuationForm ( ISegment seg, string puncForm, int iAnalysis ) : ITsString

Verifies that the ith analysis is the expected punctuation form.

VerifyWfi ( ISegment seg, int iForm, string word, int iAnalysis, IEnumerable expectedFormsWithoutAnalyses, IEnumerable expectedWordforms ) : bool

Checks that the specified analysis of the given segment is a gloss for the given word.

Method Details

CreateAnalyses() public static method

Creates analyses for the words and punctuation forms of the specified segment. Words will have WfiWordforms and glosses created if they don't already exist.
public static CreateAnalyses ( ISegment segment, ITsString paraContents, int ichBeginOffset, int ichLimOffset ) : void
segment ISegment The segment.
paraContents ITsString The para contents.
ichBeginOffset int The beginning character offset.
ichLimOffset int The character offset limit.
return void

CreateAnalyses() public static method

Creates analyses for the words and punctuation forms of the specified segment. Words will have WfiWordforms created if they don't already exist.
public static CreateAnalyses ( ISegment segment, ITsString paraContents, int ichBeginOffset, int ichLimOffset, bool fCreateGlosses ) : void
segment ISegment The segment.
paraContents ITsString The para contents.
ichBeginOffset int The beginning character offset.
ichLimOffset int The character offset limit.
fCreateGlosses bool if set to true create glosses in addition to the /// WfiWordforms for each surface form.
return void

SetupStaticFdoProperties() public static method

Setup static FDO properties
public static SetupStaticFdoProperties ( ) : void
return void

VerifyAnalysis() public static method

Verifies the analysis for the given segment.
public static VerifyAnalysis ( ISegment seg, int iSeg, IEnumerable expectedFormsWithoutAnalyses, IEnumerable expectedWordforms ) : void
seg ISegment The segment.
iSeg int The index of the segment in the paragraph.
expectedFormsWithoutAnalyses IEnumerable List of indices of wordforms which are /// not expected to have any analyses.
expectedWordforms IEnumerable List of indices of analyses that are expected to be /// word forms, rather than glosses (these should correspond to whole words that did not /// survive the resegmentation)
return void

VerifyBtFootnote() public static method

Make sure the marker for a footnote exists in the back translation and refers to the footnote properly.
public static VerifyBtFootnote ( IStFootnote footnote, IStTxtPara para, int ws, int ich ) : void
footnote IStFootnote given footnote whose marker we want to verify in the BT
para IStTxtPara vernacular paragraph which owns the back translation
ws int writing system of the back transltion
ich int Character position where ORC should be in the specified back /// translation
return void

VerifyFootnote() public static method

Make sure footnote exists and is referred to properly in the paragraph contents
public static VerifyFootnote ( IStFootnote footnote, IStTxtPara para, int ich ) : void
footnote IStFootnote
para IStTxtPara
ich int Character position where ORC should be
return void

VerifyFootnoteInSegmentFt() public static method

Make sure the marker for the specified footnote exists in the free translation of the specified segment in the specified paragraph at the specified character position.
public static VerifyFootnoteInSegmentFt ( IStFootnote footnote, IStTxtPara para, int iSeg, int ws, int ich ) : void
footnote IStFootnote The footnote
para IStTxtPara vernacular paragraph which owns the segment
iSeg int The index of the segment.
ws int the writing system
ich int Character position where ORC should be in the specified segment
return void

VerifyHyperlinkPropsAreCorrect() public static method

Asserts the properties of a run are set correctly to be a hyperlink for the given URL.
public static VerifyHyperlinkPropsAreCorrect ( ITsTextProps props, int expectedWs, string sUrl ) : void
props ITsTextProps The properties.
expectedWs int The expected writing system.
sUrl string The URL.
return void