public void SetField_ObjectisValidInteger_SetsFieldValue()
        {
            //Assign
            string expected    = "3";
            int    objectValue = 3;
            var    item        = Database.GetItem("/sitecore/content/Tests/DataMappers/SitecoreFieldIntegerMapper/SetField");
            var    field       = item.Fields[FieldName];

            var mapper = new SitecoreFieldIntegerMapper();

            using (new ItemEditing(item, true))
            {
                field.Value = string.Empty;
            }

            //Act
            using (new ItemEditing(item, true))
            {
                mapper.SetField(field, objectValue, null, null);
            }


            //Assert
            Assert.AreEqual(expected, field.Value);
        }
        public void SetField_ObjectIsDouble_ThrowsException()
        {
            //Assign
            double objectValue = 3;
            var    fieldId     = Guid.NewGuid();

            var item  = Helpers.CreateFakeItem(fieldId, string.Empty);
            var field = item.Fields[new ID(fieldId)];

            var mapper = new SitecoreFieldIntegerMapper();

            item.Editing.BeginEdit();
            //Act
            mapper.SetField(field, objectValue, null, null);


            //Assert
        }
        public void SetField_ObjectisValidInteger_SetsFieldValue()
        {
            //Assign
            string expected    = "3";
            int    objectValue = 3;
            var    fieldId     = Guid.NewGuid();

            var item  = Helpers.CreateFakeItem(fieldId, string.Empty);
            var field = item.Fields[new ID(fieldId)];

            var mapper = new SitecoreFieldIntegerMapper();

            item.Editing.BeginEdit();

            //Act
            mapper.SetField(field, objectValue, null, null);

            //Assert
            Assert.AreEqual(expected, field.Value);
        }
        public void SetField_ObjectIsDouble_ThrowsException()
        {
            //Assign
            double objectValue = 3;
            var    item        = Database.GetItem("/sitecore/content/Tests/DataMappers/SitecoreFieldIntegerMapper/SetField");
            var    field       = item.Fields[FieldName];

            var mapper = new SitecoreFieldIntegerMapper();

            using (new ItemEditing(item, true))
            {
                field.Value = string.Empty;
            }

            //Act
            using (new ItemEditing(item, true))
            {
                mapper.SetField(field, objectValue, null, null);
            }


            //Assert
        }