public void TestParseWithAdditionalSpace() { const string line = "<START> M . K . <END> <START> Schwitters <END> ? <START> Heartfield <END> ?"; var test = NameSample.Parse(line, false); Assert.AreEqual(8, test.Sentence.Length); }
public void TestTypeWithSpecialChars() { var parsedSample = NameSample.Parse( "<START:type-1> U . S . <END> " + "President <START:type_2> Barack Obama <END> is considering sending " + "additional American forces to <START:type_3-/;.,&%$> Afghanistan <END> .", false); Assert.AreEqual(3, parsedSample.Names.Length); Assert.AreEqual("type-1", parsedSample.Names[0].Type); Assert.AreEqual("type_2", parsedSample.Names[1].Type); Assert.AreEqual("type_3-/;.,&%$", parsedSample.Names[2].Type); }
public void TestWithTypesToString() { var nameSampleStr = CreateSimpleNameSample(false).ToString(); Assert.AreEqual("<START> U . S . <END> President <START> Barack Obama <END> is considering " + "sending additional American forces to <START> Afghanistan <END> .", nameSampleStr); var parsedSample = NameSample.Parse("<START:Location> U . S . <END> " + "President <START:Person> Barack Obama <END> is considering sending " + "additional American forces to <START:Location> Afghanistan <END> .", false); Assert.AreEqual(CreateSimpleNameSample(true), parsedSample); }
public void TestTypeWithInvalidChar2() { NameSample.Parse("<START:abc>a> token <END>", false); }
public void TestTypeWithNewLine() { NameSample.Parse("<START:abc\na> token <END>", false); }
public void TestTypeWithSpace() { NameSample.Parse("<START:abc a> token <END>", false); }
public void TestMissingType() { NameSample.Parse("<START:> token <END>", false); }
public void TestTypeWithInvalidChar2() { Assert.Throws <InvalidOperationException> (() => { NameSample.Parse("<START:abc>a> token <END>", false); }); }
public void TestMissingType() { Assert.Throws <InvalidOperationException> (() => { NameSample.Parse("<START:> token <END>", false); }); }