public void GetField_FieldContainsInvalidValidInteger_ReturnsInteger()
        {
            //Assign
            string fieldValue = "hello world";
            int    expected   = 3;
            var    fieldId    = Guid.NewGuid();

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

            var mapper = new SitecoreFieldIntegerMapper();

            //Act
            var result = (int)mapper.GetField(field, null, null);

            //Assert
        }
        public void GetField_FieldContainsEmptyString_ReturnsIntegerZero()
        {
            //Assign
            string fieldValue = string.Empty;
            int    expected   = 0;
            var    fieldId    = Guid.NewGuid();

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

            var mapper = new SitecoreFieldIntegerMapper();

            //Act
            var result = (int)mapper.GetField(field, null, null);

            //Assert
            Assert.AreEqual(expected, result);
        }
        public void GetField_FieldContainsInvalidValidInteger_ReturnsInteger()
        {
            //Assign
            string fieldValue = "hello world";
            int    expected   = 3;
            var    item       = Database.GetItem("/sitecore/content/Tests/DataMappers/SitecoreFieldIntegerMapper/GetField");
            var    field      = item.Fields[FieldName];

            var mapper = new SitecoreFieldIntegerMapper();

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

            //Act
            var result = (int)mapper.GetField(field, null, null);

            //Assert
            Assert.AreEqual(expected, result);
        }