public void SetPropertyValue_Key_SetsValue() { var types = new TypeMemberInfoCollection(); var topic = TopicFactory.Create("Test", "ContentType"); var isKeySet = types.SetPropertyValue(topic, "Key", "NewKey"); var key = types.GetPropertyValue(topic, "Key", typeof(string)).ToString(); Assert.IsTrue(isKeySet); Assert.AreEqual<string>("NewKey", topic.Key); Assert.AreEqual<string>("NewKey", key); }
public void SetPropertyValue_DateTime_SetsValue() { var types = new TypeMemberInfoCollection(); var topic = TopicFactory.Create("Test", "ContentType"); var isDateSet = types.SetPropertyValue(topic, "LastModified", "June 3, 2008"); isDateSet = types.SetPropertyValue(topic, "LastModified", "2008-06-03") && isDateSet; isDateSet = types.SetPropertyValue(topic, "LastModified", "06/03/2008") && isDateSet; var lastModified = DateTime.Parse( types.GetPropertyValue(topic, "LastModified", typeof(DateTime)).ToString(), CultureInfo.InvariantCulture ); Assert.IsTrue(isDateSet); Assert.AreEqual<DateTime>(new(2008, 6, 3), topic.LastModified); Assert.AreEqual<DateTime>(new(2008, 6, 3), lastModified); }