delegateas/XrmMockup

CloneEntity should properly copy object attributes, rather than pointing the new entity at the current entity values.

MattTrinder1 opened this issue · 1 comments

var account1 = new Entity("account");
var money = new Money(123.45M);
account1["marketcap"] = money;

var account2 = (account as Entity).CloneEntity();
Assert.Equal(123.45M, account2.GetAttributeValue<Money>("marketcap").Value);

money.Value = 333.33M;
Assert.Equal(123.45M, account2.GetAttributeValue<Money>("marketcap").Value);

This fails as account2 is still referencing account1's money value.

Added in 1.7.4