public void CustomPublishedContent_Property_IsMapped()
        {
            var value = "myValue";

            var property = new PublishedContentPropertyMock
            {
                Alias = "myProperty",
                Value = value
            };

            var content = new CustomPublishedContentMock
            {
                Properties = new[] { property }
            };

            var model = content.As<MyModel>();

            Assert.That(model.MyProperty, Is.EqualTo(value));
        }
        public void CustomPublishedContent_Property_IsMapped()
        {
            // The idea here is that the value from the concrete property
            // on the custom model take presidence over the
            // IPublishedContentProperty value.

            var propertyValue = "foo";
            var objectValue   = "bar";

            var content = new CustomPublishedContentMock
            {
                Properties = new[] { new MockPublishedContentProperty("myProperty", propertyValue) },
                MyProperty = objectValue
            };

            var model = content.As <MyModel>();

            Assert.That(model.MyProperty, Is.Not.EqualTo(propertyValue));
            Assert.That(model.MyProperty, Is.EqualTo(objectValue));
        }
        public void CustomPublishedContent_Property_IsMapped()
        {
            var propertyValue = "foo";
            var objectValue   = "bar";

            var property = new PublishedContentPropertyMock
            {
                Alias = "myProperty",
                Value = propertyValue
            };

            var content = new CustomPublishedContentMock
            {
                Properties = new[] { property },
                MyProperty = objectValue
            };

            var model = content.As <MyModel>();

            Assert.That(model.MyProperty, Is.Not.EqualTo(propertyValue));
            Assert.That(model.MyProperty, Is.EqualTo(objectValue));
        }