Example #1
0
        public void CanHandle_IsListOfMappedClassWithLinkedConfig_ReturnsFalse()
        {
            //Assign
            var config = new SitecoreLinkedConfiguration();

            config.PropertyInfo = new FakePropertyInfo(typeof(List <StubMapped>));
            var mapper  = new SitecoreLinkedMapper();
            var context = Context.Create(Utilities.CreateStandardResolver());

            context.Load(new SitecoreAttributeConfigurationLoader("Glass.Mapper.Sc.Integration"));


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

            //Assert
            Assert.IsFalse(result);
        }
        public void CanHandle_IsEnumerableOfMappedClassWithWrongConfig_ReturnsFalse()
        {
            //Assign
            var config = new SitecoreFieldConfiguration();

            config.PropertyInfo = typeof(StubClass).GetProperty("StubMappeds");
            var mapper  = new SitecoreLinkedMapper();
            var context = Context.Create(Utilities.CreateStandardResolver());

            context.Load(new SitecoreAttributeConfigurationLoader("Glass.Mapper.Sc.Integration"));


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

            //Assert
            Assert.IsFalse(result);
        }
Example #3
0
        public void CanHandle_IsEnumerableOfNotMappedClassWithLinkedConfig_ReturnsTrueOnDemand()
        {
            //Assign
            var config = new SitecoreLinkedConfiguration();

            config.PropertyInfo = typeof(StubClass).GetProperty("StubNotMappeds");

            var mapper  = new SitecoreLinkedMapper();
            var context = Context.Create(Utilities.CreateStandardResolver());

            context.Load(new OnDemandLoader <SitecoreTypeConfiguration>(typeof(StubClass)));



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

            //Assert
            Assert.IsTrue(result);
        }