/// <summary>
        /// Configures the specified property info.
        /// </summary>
        /// <param name="propertyInfo">The property info.</param>
        /// <returns></returns>
        public override Mapper.Configuration.AbstractPropertyConfiguration Configure(PropertyInfo propertyInfo)
        {
            var config = new UmbracoIdConfiguration();

            base.Configure(propertyInfo, config);
            return(config);
        }
Example #2
0
        public void CanHandle_IncorrectPropertType_ReturnsFalse()
        {
            //Assign
            var config = new UmbracoIdConfiguration();
            var type1  = typeof(int);
            var mapper = new StubMapper(type1);

            config.PropertyInfo = typeof(Stub).GetProperty("Property");

            //Act
            var result = mapper.CanHandle(config, null);

            //Assert
            Assert.IsFalse(result);
        }
Example #3
0
        public void MapToProperty_ContentIdAsGuid_ReturnsIdAsGuid()
        {
            var content = _contentService.GetById(new Guid("{263768E1-E958-4B00-BB00-191CC33A3F48}"));

            //Assign
            var mapper   = new UmbracoIdMapper();
            var config   = new UmbracoIdConfiguration();
            var property = typeof(Stub).GetProperty("Key");

            Assert.IsNotNull(content, "Content is null, check in Umbraco that item exists");

            config.PropertyInfo = property;

            mapper.Setup(new DataMapperResolverArgs(null, config));

            var dataContext = new UmbracoDataMappingContext(null, content, null);
            var expected    = content.Key;

            //Act
            var value = mapper.MapToProperty(dataContext);

            //Assert
            Assert.AreEqual(expected, value);
        }
 /// <summary>
 /// Configures the specified property info.
 /// </summary>
 /// <param name="propertyInfo">The property info.</param>
 /// <param name="config">The config.</param>
 public void Configure(PropertyInfo propertyInfo, UmbracoIdConfiguration config)
 {
     base.Configure(propertyInfo, config);
 }
 /// <summary>
 /// Configures the specified property info.
 /// </summary>
 /// <param name="propertyInfo">The property info.</param>
 /// <param name="config">The config.</param>
 public void Configure(PropertyInfo propertyInfo, UmbracoIdConfiguration config)
 {
     base.Configure(propertyInfo, config);
 }
 /// <summary>
 /// Configures the specified property info.
 /// </summary>
 /// <param name="propertyInfo">The property info.</param>
 /// <returns></returns>
 public override Mapper.Configuration.AbstractPropertyConfiguration Configure(PropertyInfo propertyInfo)
 {
     var config = new UmbracoIdConfiguration();
     base.Configure(propertyInfo, config);
     return config;
 }