public void SetField_ObjectisValidDecimal_SetsFieldValue()
        {
            //Assign
            string  expected    = "3.141592";
            decimal objectValue = 3.141592M;
            var     item        = Database.GetItem("/sitecore/content/Tests/DataMappers/SitecoreFieldDecimalMapper/SetField");
            var     field       = item.Fields[FieldName];

            var mapper = new SitecoreFieldDecimalMapper();

            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_ObjectIsInt_ThrowsException()
        {
            //Assign
            int objectValue = 3;
            var fieldId     = Guid.NewGuid();

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

            var mapper = new SitecoreFieldDecimalMapper();

            item.Editing.BeginEdit();

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

            //Assert
        }
        public void SetField_ObjectIsInt_ThrowsException()
        {
            //Assign
            int objectValue = 3;
            var item        = Database.GetItem("/sitecore/content/Tests/DataMappers/SitecoreFieldDecimalMapper/SetField");
            var field       = item.Fields[FieldName];

            var mapper = new SitecoreFieldDecimalMapper();

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

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


            //Assert
        }
        public void SetField_ObjectisValidDecimal_SetsFieldValue()
        {
            //Assign
            string  expected    = "3.141592";
            decimal objectValue = 3.141592M;
            var     fieldId     = Guid.NewGuid();

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

            var mapper = new SitecoreFieldDecimalMapper();

            item.Editing.BeginEdit();

            //Act

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



            //Assert
            Assert.AreEqual(expected, field.Value);
        }