Ejemplo n.º 1
0
        public void ReadOnly_ReturnsTrue()
        {
            //Assign
            var  mapper   = new UmbracoIdMapper();
            bool expected = true;

            //Act
            bool value = mapper.ReadOnly;

            //Assert
            Assert.AreEqual(expected, value);
        }
Ejemplo n.º 2
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);
        }