示例#1
0
        public void CanHandle_TypeIsHandledWithConfig_ReturnsTrue()
        {
            //Assign
            var config = new UmbracoPropertyConfiguration();
            var type1  = typeof(string);
            var mapper = new StubMapper(type1);

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

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

            //Assert
            Assert.IsTrue(result);
        }
示例#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);
        }
        public void CanHandle_TypeIsHandledWithConfig_ReturnsTrue()
        {
            //Assign
            var config = new SitecoreFieldConfiguration();
            var type1 = typeof (string);
            var mapper = new StubMapper(type1);

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

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

            //Assert
            Assert.IsTrue(result);
        }
示例#4
0
        public void CanHandle_TwoTypesAreHandledWithConfig_ReturnsTrue()
        {
            //Assign
            var config = new SitecoreFieldConfiguration();
            var type2  = typeof(string);
            var type1  = typeof(int);
            var mapper = new StubMapper(type1, type2);

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

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

            //Assert
            Assert.IsTrue(result);
        }
        public void CanHandle_TwoTypesAreHandledWithConfig_ReturnsTrue()
        {
            //Assign
            var config = new UmbracoPropertyConfiguration();
            var type2 = typeof(string);
            var type1 = typeof(int);
            var mapper = new StubMapper(type1, type2);

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

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

            //Assert
            Assert.IsTrue(result);
        }
        public void CanHandle_IncorrectConfigType_ReturnsFalse()
        {
            //Assign
            var config = new SitecoreIdConfiguration();
            var type2 = typeof(string);
            var type1 = typeof(int);
            var mapper = new StubMapper(type1, type2);

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

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

            //Assert
            Assert.IsFalse(result);
        }