public void SetField_Guidpassed_ValueSetOnField()
        {
            //Assign
            var expected = "{FC1D0AFD-71CC-47E2-84B3-7F1A2973248B}";
            var fieldId = Guid.NewGuid();

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

            var value = new Guid(expected);

            var mapper = new SitecoreFieldGuidMapper();

          item.Editing.BeginEdit();

            //Act
         
                mapper.SetField(field, value, null, null);
            
            //Assert
            Assert.AreEqual(expected, field.Value);
        }
        public void SetField_Guidpassed_ValueSetOnField()
        {
            //Assign
            var expected = "{FC1D0AFD-71CC-47E2-84B3-7F1A2973248B}";
            var item = Database.GetItem("/sitecore/content/Tests/DataMappers/SitecoreFieldGuidMapper/SetField");
            var field = item.Fields[FieldName];
            var value = new Guid(expected);

            var mapper = new SitecoreFieldGuidMapper();

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

            //Act
            using (new ItemEditing(item, true))
            {
                mapper.SetField(field, value, null, null);
            }
            //Assert
            Assert.AreEqual(expected, field.Value);
        }
        public void SetField_IntegerPassed_ValueSetOnField()
        {
            //Assign
            var fieldId = Guid.NewGuid();

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

            var value = 1;

            var mapper = new SitecoreFieldGuidMapper();

            item.Editing.BeginEdit();

            //Act

            Assert.Throws<MapperException>(() =>
            {
                mapper.SetField(field, value, null, null);
            });
            //Assert
        }
        public void SetField_IntegerPassed_ValueSetOnField()
        {
            //Assign
            var item = Database.GetItem("/sitecore/content/Tests/DataMappers/SitecoreFieldGuidMapper/SetField");
            var field = item.Fields[FieldName];
            var value = 1;

            var mapper = new SitecoreFieldGuidMapper();

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

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