public void Existing_Inherited_Object_Mapped() { var propertyValue = "Foo Bar"; var property = new PublishedContentPropertyMock { Alias = "prop3", Value = propertyValue }; var content = new PublishedContentMock { Properties = new[] { property } }; var value = "Hello world"; var model = new MyInheritedModel() { MyProperty3 = value }; // run through Ditto, the expected behaviour is that the Umbraco property value will overwrite the previous value. content.As(instance: model); Assert.That(model.MyProperty3, Is.Not.EqualTo(value)); Assert.That(model.MyProperty3, Is.EqualTo(propertyValue)); }
public void Existing_Base_Object_Mapped() { var propertyValue = "Foo Bar"; var property = new PublishedContentPropertyMock { Alias = "prop3", Value = propertyValue }; var content = new PublishedContentMock { Properties = new[] { property } }; var value = "Hello world"; var model = new MyInheritedModel() { MyProperty3 = value }; // down-cast the model to the base type, so the inherited type properties should not be mapped. content.As<MyBaseModel>(instance: model); Assert.That(model.MyProperty3, Is.EqualTo(value)); Assert.That(model.MyProperty3, Is.Not.EqualTo(propertyValue)); }
public void Existing_Inherited_Object_Mapped() { var propertyValue = "Foo Bar"; var content = new MockPublishedContent { Properties = new[] { new MockPublishedContentProperty("MyProperty3", propertyValue) } }; var value = "Hello world"; var model = new MyInheritedModel() { MyProperty3 = value }; // run through Ditto, the expected behaviour is that the Umbraco property value will overwrite the previous value. content.As(instance: model); Assert.That(model.MyProperty3, Is.Not.EqualTo(value)); Assert.That(model.MyProperty3, Is.EqualTo(propertyValue)); }
public void Existing_Base_Object_Mapped() { var propertyValue = "Foo Bar"; var content = new MockPublishedContent { Properties = new[] { new MockPublishedContentProperty("MyProperty3", propertyValue) } }; var value = "Hello world"; var model = new MyInheritedModel() { MyProperty3 = value }; // down-cast the model to the base type, so the inherited type properties should not be mapped. content.As <MyBaseModel>(instance: model); Assert.That(model.MyProperty3, Is.EqualTo(value)); Assert.That(model.MyProperty3, Is.Not.EqualTo(propertyValue)); }