Add HasFields property to LineParser.

This commit is contained in:
Daniel Kraus 2015-06-21 06:15:27 +02:00
parent cfbf3c7859
commit 9e0f8a85ae
2 changed files with 21 additions and 0 deletions

View File

@ -60,5 +60,14 @@ namespace Tests
Assert.AreEqual("a , simple ;", lp.Fields[1]);
Assert.AreEqual("line", lp.Fields[2]);
}
[Test]
public void ParseLineWithoutFields()
{
LineParser lp = new LineParser("# no fields");
Assert.IsFalse(lp.HasFields);
lp.Line = "two fields";
Assert.IsTrue(lp.HasFields);
}
}
}

View File

@ -54,6 +54,18 @@ namespace zaaReloaded2.Dictionaries
/// </summary>
public string[] Fields { get; private set; }
/// <summary>
/// Indicates whether the parsed <see cref="Line"/>
/// contains fields.
/// </summary>
public bool HasFields
{
get
{
return Fields.Length > 0;
}
}
#endregion
#region Constructors