private void AssertPropertyContents(ParsedTopic parsedTopic, string propertyName, string expectedValue) { Assert.IsTrue(parsedTopic.Properties.Contains(propertyName), "Topic does not contain a property named " + propertyName); TopicProperty property = parsedTopic.Properties[propertyName]; Assert.AreEqual(expectedValue, property.LastValue, "Checking that property has correct value."); }
public static ParsedTopic Parse(string text) { TopicPropertyCollection properties = ParseProperties(text); TopicRevisionCollection topicLinks = ParseTopicLinks(text); ExternalReferencesMap externalReferences = ParseExternalReferences(text); ParsedTopic parsedTopic = new ParsedTopic(properties, topicLinks, externalReferences); return parsedTopic; }
private void AddBuiltInProperty(ParsedTopic parsedTopic, string propertyName, string value) { // The built-in topics show up as the last value if the property already exists. // This should be reasonably back-compatible, as the last value wins when people // don't remember that properties can have multiple values. TopicProperty property = null; if (parsedTopic.Properties.Contains(propertyName)) { property = parsedTopic.Properties[propertyName]; } else { property = new TopicProperty(propertyName); parsedTopic.Properties.Add(property); } TopicPropertyValue topicPropertyValue = new TopicPropertyValue(value); property.Values.Add(topicPropertyValue); }