diff --git a/objectModel/CSharp/Microsoft.CommonDataModel.ObjectModel.Tests/Persistence/CdmFolder/EntityAttribute/CdmEntityAttributePersistenceTests.cs b/objectModel/CSharp/Microsoft.CommonDataModel.ObjectModel.Tests/Persistence/CdmFolder/EntityAttribute/CdmEntityAttributePersistenceTests.cs index 1c92a1dcc9..71ba6a759e 100644 --- a/objectModel/CSharp/Microsoft.CommonDataModel.ObjectModel.Tests/Persistence/CdmFolder/EntityAttribute/CdmEntityAttributePersistenceTests.cs +++ b/objectModel/CSharp/Microsoft.CommonDataModel.ObjectModel.Tests/Persistence/CdmFolder/EntityAttribute/CdmEntityAttributePersistenceTests.cs @@ -41,5 +41,35 @@ public void TestDescriptionAndDisplayName() // Checks if there is no residue of the transformation of the properties into traits. Assert.IsNull(data.AppliedTraits); } + + /// + /// Tests if updating the properties description and displayName will persist + /// + [TestMethod] + public void TestUpdatingDescriptionAndDisplayName() + { + var corpus = new CdmCorpusDefinition(); + var entityName = "TheEntity"; + var description = "entityAttributeDescription"; + var displayName = "whatABeutifulDisplayName"; + var inputData = new JObject() + { + ["name"] = entityName, + ["displayName"] = displayName, + ["description"] = description + }; + + var instance = EntityAttributePersistence.FromData(corpus.Ctx, inputData); + + var newDescription = "newEntityAttributeDescription"; + var newDisplayName = "anotherBeautifulDisplanyName"; + + instance.Description = newDescription; + instance.DisplayName = newDisplayName; + + // Make sure the properties got updated on the instance correctly + Assert.AreEqual(newDescription, instance.Description); + Assert.AreEqual(newDisplayName, instance.DisplayName); + } } } diff --git a/objectModel/CSharp/Microsoft.CommonDataModel.ObjectModel/Cdm/CdmConstantEntityDefinition.cs b/objectModel/CSharp/Microsoft.CommonDataModel.ObjectModel/Cdm/CdmConstantEntityDefinition.cs index 943c9260ff..b60ce37daf 100644 --- a/objectModel/CSharp/Microsoft.CommonDataModel.ObjectModel/Cdm/CdmConstantEntityDefinition.cs +++ b/objectModel/CSharp/Microsoft.CommonDataModel.ObjectModel/Cdm/CdmConstantEntityDefinition.cs @@ -141,7 +141,7 @@ internal string FetchConstantValue(ResolveOptions resOpt, dynamic attReturn, dyn internal string UpdateConstantValue(ResolveOptions resOpt, dynamic attReturn, string newValue, dynamic attSearch, string valueSearch, int order) { string result = null; - Func action = found => { result = found; return found; }; + Func action = found => { result = newValue; return newValue; }; this.FindValue(resOpt, attReturn, attSearch, valueSearch, order, action); return result; }