Ejemplo n.º 1
0
        public void CanHandle_StringType_ReturnsTrue()
        {
            //Assign
            var mapper = new UmbracoPropertyStringMapper();
            var config = new UmbracoPropertyConfiguration();

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

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

            //Assert
            Assert.IsTrue(result);
        }
Ejemplo n.º 2
0
        public void SetProperty_PropertyString_ValueWrittenToProperty()
        {
            //Assign
            var contentTypeProperty = "TestProperty";
            var expected            = "Test data";
            var content             = _contentService.GetById(new Guid("{5F6D851E-46C0-40C7-A93A-EC3F6D7EBA3E}"));
            var property            = content.Properties[contentTypeProperty];

            var mapper = new UmbracoPropertyStringMapper();
            var config = new UmbracoPropertyConfiguration();

            //Act
            mapper.SetProperty(property, expected, config, null);

            //Assert
            Assert.AreEqual(expected, property.Value);
        }
Ejemplo n.º 3
0
        public void GetProperty_PropertyContainsData_StringIsReturned()
        {
            //Assign
            var fieldValue          = "hello world";
            var contentTypeProperty = "TestProperty";

            var content  = _contentService.GetById(new Guid("{5F6D851E-46C0-40C7-A93A-EC3F6D7EBA3E}"));
            var property = content.Properties[contentTypeProperty];

            property.Value = fieldValue;

            var mapper = new UmbracoPropertyStringMapper();
            var config = new UmbracoPropertyConfiguration();

            //Act
            var result = mapper.GetProperty(property, config, null) as string;

            //Assert
            Assert.AreEqual(fieldValue, result);
        }