Exemplo n.º 1
0
        public void GetDataHandler_HandlerFromDataHandlerCorrectClassButErrorWhenIfnstantiated_ThrowsException()
        {
            //Assign
            InstanceContext  context  = new InstanceContext(new Dictionary <Type, SitecoreClassConfig>(), Utility.GetDefaultDataHanlders(), null);
            SitecoreProperty property = new SitecoreProperty();

            property.Attribute             = new SitecoreFieldAttribute();
            property.Property              = typeof(InstanceContextFixtureNS.GetDataHandlerClass).GetProperty("IntProperty");
            property.Attribute.DataHandler = typeof(InstanceContextFixtureNS.GetDataHandlerClassErroring);

            //Act
            var result = context.GetDataHandler(property);

            //Assert
        }
Exemplo n.º 2
0
        public void GetDataHandler_HandlerFromStandardList()
        {
            //Assign
            InstanceContext  context  = new InstanceContext(new Dictionary <Type, SitecoreClassConfig>(), Utility.GetDefaultDataHanlders(), null);
            SitecoreProperty property = new SitecoreProperty();

            property.Attribute = new SitecoreFieldAttribute();
            property.Property  = typeof(InstanceContextFixtureNS.GetDataHandlerClass).GetProperty("IntProperty");

            //Act
            var result = context.GetDataHandler(property);

            //Assert
            Assert.IsTrue(result is SitecoreFieldIntegerHandler);
        }
        public void GetDataHandler_HandlerFromDataHandlerCorrectClassButErrorWhenIfnstantiated_ThrowsException()
        {
            //Assign
            InstanceContext context = new InstanceContext(new Dictionary<Type, SitecoreClassConfig>(), Utility.GetDefaultDataHanlders());
            SitecoreProperty property = new SitecoreProperty();
            property.Attribute = new SitecoreFieldAttribute();
            property.Property = typeof(InstanceContextFixtureNS.GetDataHandlerClass).GetProperty("IntProperty");
            property.Attribute.DataHandler = typeof(InstanceContextFixtureNS.GetDataHandlerClassErroring);

            //Act
            var result = context.GetDataHandler(property);

            //Assert
        }
        public void GetDataHandler_HandlerFromDataHandler()
        {
            //Assign
            InstanceContext context = new InstanceContext(new Dictionary<Type, SitecoreClassConfig>(), Utility.GetDefaultDataHanlders());
            SitecoreProperty property = new SitecoreProperty();
            property.Attribute = new SitecoreFieldAttribute();
            property.Property = typeof(InstanceContextFixtureNS.GetDataHandlerClass).GetProperty("IntProperty");
            property.Attribute.DataHandler = typeof(InstanceContextFixtureNS.CustomDataHandler);

            //Act
            var result = context.GetDataHandler(property);

            //Assert
            Assert.IsTrue(result is InstanceContextFixtureNS.CustomDataHandler);
        }