MapToCms() публичный Метод

Maps data from the .Net property value to the CMS value
/// Can't set DisplayName. Value is not of type System.String /// or /// Can't set Name. Value is not of type System.String /// or /// You can not save SitecoreInfo {0}.Formatted(scConfig.Type) /// You can not set an empty or null Item name
public MapToCms ( AbstractDataMappingContext mappingContext ) : void
mappingContext AbstractDataMappingContext The mapping context.
Результат void
        public void MapToCms_SavingName_UpdatesTheItemName()
        {
            //Assign

            using (Db database = new Db
            {
                new Sitecore.FakeDb.DbItem("TestItem")
            })
            {
                var type = SitecoreInfoType.Name;
                var expected = "new  name";

                var mapper = new SitecoreInfoMapper();
                var config = new SitecoreInfoConfiguration();
                config.Type = type;
                mapper.Setup(new DataMapperResolverArgs(null, config));

                var item = database.GetItem("/sitecore/Content/TestItem");

                Assert.IsNotNull(item, "Item is null, check in Sitecore that item exists");


                var dataContext = new SitecoreDataMappingContext(null, item, null);
                dataContext.PropertyValue = expected;

                string actual = string.Empty;

                //Act
                using (new SecurityDisabler())
                {
                    item.Editing.BeginEdit();
                    mapper.MapToCms(dataContext);
                    actual = item.Name;
                    item.Editing.CancelEdit();
                }

                //Assert
                Assert.AreEqual(expected, actual);
            }
        }
        public void MapToCms_SavingDisplayName_UpdatesTheDisplayNameField()
        {
            //Assign
            var type = SitecoreInfoType.DisplayName;
            var expected = "new display name";

            var mapper = new SitecoreInfoMapper();
            var config = new SitecoreInfoConfiguration();
            config.Type = type;
            mapper.Setup(new DataMapperResolverArgs(null,config));

            var item = _db.GetItem("/sitecore/Content/Tests/DataMappers/SitecoreInfoMapper/DataMappersEmptyItem");

            Assert.IsNotNull(item, "Item is null, check in Sitecore that item exists");


            var dataContext = new SitecoreDataMappingContext(null, item, null);
            dataContext.PropertyValue = expected;

            string actual = string.Empty;

            //Act
            using (new SecurityDisabler())
            {
                item.Editing.BeginEdit();
                mapper.MapToCms(dataContext);
                actual = item[Global.Fields.DisplayName];
                item.Editing.CancelEdit();
            }

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