예제 #1
0
        public void ReadOnly_ReturnsTrue()
        {
            //Assign
            var mapper = new UmbracoIdMapper();
            bool expected = true;

            //Act
            bool value = mapper.ReadOnly;

            //Assert
            Assert.AreEqual(expected, value);
        }
예제 #2
0
        public void MapToProperty_ContentIdAsInt_ReturnsIdAsInt()
        {
            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("Id");

            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.Id;

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

            //Assert
            Assert.AreEqual(expected, value);
        }