public void TestInheritedModel() { CalendarProperties <InheritedModel> modelProperties = new CalendarProperties <InheritedModel>(); IList <string> properties = modelProperties.GetProperties(); Assert.That(properties, Contains.Item("Id").And.Contains("Name").And.Contains("Value")); Assert.That(properties.Count, Is.EqualTo(3)); }
public void TestReadOnlyProperties() { ModelWithReadOnly model = new ModelWithReadOnly(); CalendarProperties <ModelWithReadOnly> modelProperties = new CalendarProperties <ModelWithReadOnly>(); Assert.That(modelProperties.GetProperties().Count, Is.EqualTo(4)); model.Name = "name1"; AssertPropertyGetValue(modelProperties, model, "ReadOnlyName", "name1"); AssertPropertyNotSetValue(modelProperties, model, "ReadOnlyName", "invalid name"); }
public void TestWriteOnlyProperties() { ModelWithWriteOnly model = new ModelWithWriteOnly(); CalendarProperties <ModelWithWriteOnly> modelProperties = new CalendarProperties <ModelWithWriteOnly>(); Assert.That(modelProperties.GetProperties().Count, Is.EqualTo(4)); AssertPropertySetValue(modelProperties, model, "Id", "100"); AssertPropertySetValue(modelProperties, model, "Name", "old name"); AssertPropertySetValue(modelProperties, model, "Value", "123.4"); Assert.That(model.Id, Is.EqualTo(100)); Assert.That(model.Name, Is.EqualTo("old name")); Assert.That(model.Value, Is.EqualTo(123.4)); AssertPropertySetValue(modelProperties, model, "WriteOnlyName", "new name"); Assert.That(model.Name, Is.EqualTo("new name")); AssertPropertyNotGetValue(modelProperties, model, "WriteOnlyName"); }