public void Basic_Model_Populated() { var archetypeJson = "{\"fieldsets\":[{\"properties\":[{\"alias\":\"textField\",\"value\":\"Testing text field\"}],\"alias\":\"simpleModel\",\"disabled\":false}]}"; var archetype = JsonConvert.DeserializeObject<ArchetypeModel>(archetypeJson); var property = new PublishedPropertyMock("myProperty", archetype, true); var content = new PublishedContentMock { Properties = new[] { property } }; var model = content.As<BasicModel_TypedProperty>(); Assert.IsNotNull(model); Assert.IsNotNull(model.MyProperty); Assert.IsInstanceOf<SimpleModel>(model.MyProperty); }
public void Basic_Model_Default() { var archetype = new ArchetypeModel(); var property = new PublishedPropertyMock("myProperty", archetype, true); var content = new PublishedContentMock { Properties = new[] { property } }; var model = content.As<BasicModel>(); Assert.IsNotNull(model); Assert.IsNotNull(model.MyProperty); Assert.IsInstanceOf<ArchetypeModel>(model.MyProperty); Assert.IsEmpty(model.MyProperty.Fieldsets); }