Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/// <summary>
/// Tests if updating the properties description and displayName will persist
/// </summary>
[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);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, string> action = found => { result = found; return found; };
Func<string, string> action = found => { result = newValue; return newValue; };
this.FindValue(resOpt, attReturn, attSearch, valueSearch, order, action);
return result;
}
Expand Down