public void GetFieldCode(bool nestedFields)
{
Document doc = new Document(MyDir + "Field.FieldCode.docx");
foreach (Field field in doc.Range.Fields)
{
if (field.Type == FieldType.FieldIf)
{
FieldIf fif = (FieldIf)field;
Assert.AreEqual(" IF MERGEFIELD Q223 > 0 \" (and additionally London Weighting of MERGEFIELD Q223 \\f £ per hour) \" \"\" ", fif.GetFieldCode());
if (nestedFields)
{
Assert.AreEqual(" IF MERGEFIELD Q223 > 0 \" (and additionally London Weighting of MERGEFIELD Q223 \\f £ per hour) \" \"\" ", fif.GetFieldCode(true));
}
else
{
Assert.AreEqual(" IF > 0 \" (and additionally London Weighting of per hour) \" \"\" ", fif.GetFieldCode(false));
}
}
}
}