public void MapPropertyToCms_DoesNotAlterObject() { //Assign var fieldValue = "hello world"; var propertyValue = "goodbye world"; var item = Database.GetItem("/sitecore/content/Tests/DataMappers/SitecoreIgnoreMapper/Target"); var field = item.Fields["Field"]; var mapper = new SitecoreIgnoreMapper(); var config = new SitecoreIgnoreMapper(); using (new ItemEditing(item, true)) { field.Value = fieldValue; } var stub = new StubClass(); stub.Field = propertyValue; var context = new SitecoreDataMappingContext(stub, item, null); //Act mapper.MapPropertyToCms(context); //Assert Assert.AreEqual(fieldValue, item.Fields["Field"].Value); }
public void MapPropertyToCms_DoesNotAlterObject() { //Assign string targetPath = "/sitecore/content/target"; var templateId = ID.NewID; using (Db database = new Db { new DbTemplate(templateId) { new DbField("Field") { Type = "text" } }, new Sitecore.FakeDb.DbItem("Target", ID.NewID, templateId) { { "Field", "" } } }) { var fieldValue = "hello world"; var propertyValue = "goodbye world"; var item = database.GetItem(targetPath); var field = item.Fields["Field"]; var mapper = new SitecoreIgnoreMapper(); var config = new SitecoreIgnoreMapper(); var options = new GetItemOptionsParams(); using (new ItemEditing(item, true)) { field.Value = fieldValue; } var stub = new StubClass(); stub.Field = propertyValue; var context = new SitecoreDataMappingContext(stub, item, null, options); //Act mapper.MapPropertyToCms(context); //Assert Assert.AreEqual(fieldValue, item.Fields["Field"].Value); } }