CanHandle() 공개 메소드

Indicates that the data mapper will mapper to and from the property
public CanHandle ( AbstractPropertyConfiguration configuration, Context context ) : bool
configuration Glass.Mapper.Configuration.AbstractPropertyConfiguration The configuration.
context Context The context.
리턴 bool
        public void CanHandle_ConfigIsNodeAndClassMapped_ReturnsTrue()
        {
            //Assign
            var config = new SitecoreNodeConfiguration();
            var mapper = new SitecoreNodeMapper();

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

            //Assert
            Assert.IsTrue(result);
        }
        public void CanHandle_ConfigIsNodeAndClassNotMapped_ReturnsTrueOndemand()
        {
            //Assign
            var config = new SitecoreNodeConfiguration();
            var context = Context.Create(Utilities.CreateStandardResolver());
            var mapper = new SitecoreNodeMapper();

            config.PropertyInfo = typeof (Stub).GetProperty("StubNotMapped");
            context.Load(new SitecoreAttributeConfigurationLoader("Glass.Mapper.Sc.Integration"));

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

            //Assert
            Assert.IsTrue(result);
        }