public void ShouldNotReturnRecord_WhenInfoboxHasNoValue() { var infoboxParser = new InfoboxParser(); var infobox = "{name=|name2=testName2}"; var result = infoboxParser.GetKeyValue(infobox).ToList(); Assert.AreEqual(result.Count(), 1); Assert.AreEqual(result[0].Key, "name2"); Assert.AreEqual(result[0].Value, "testName2"); }
public void ShouldReturnOneRecord_WhenInfoboxWithOneKeyValuePairPassed() { var infoboxParser = new InfoboxParser(); var infobox = "{name=testName}"; var result = infoboxParser.GetKeyValue(infobox).ToList(); Assert.AreEqual(result.Count(), 1); Assert.AreEqual(result[0].Key, "name"); Assert.AreEqual(result[0].Value, "testName"); }
public void ShouldReturnRecordsWithBracersAsValue_WhenInfoboxContainsNestedRoundedBracketsInValue() { var infoboxParser = new InfoboxParser(); var infobox = "{name=testName|name2=testName2((nestedName=nestedTestName|nestedName2=nestedTestName2))}"; var result = infoboxParser.GetKeyValue(infobox).ToList(); Assert.AreEqual(result.Count(), 2); Assert.AreEqual(result[0].Key, "name"); Assert.AreEqual(result[0].Value, "testName"); Assert.AreEqual(result[1].Key, "name2"); Assert.AreEqual(result[1].Value, "testName2((nestedName=nestedTestName|nestedName2=nestedTestName2))"); }
public void ShouldReturnTwoRecords_WhenInfoboxWithTwoKeyValuePairsPassed() { var infoboxParser = new InfoboxParser(); var infobox = "{name=testName|name2=testName2}"; var result = infoboxParser.GetKeyValue(infobox).ToList(); Assert.AreEqual(result.Count(), 2); Assert.AreEqual(result[0].Key, "name"); Assert.AreEqual(result[0].Value, "testName"); Assert.AreEqual(result[1].Key, "name2"); Assert.AreEqual(result[1].Value, "testName2"); }