private Fingerprint Hash(EvaluationResult obj) { var helper = new HashingHelper(PathTable, recordFingerprintString: false); if (!AmbientValueCache.TryHashValue(obj, helper)) { Assert.False(true, "Expected to successfully hash the value"); } return(helper.GenerateHash()); }
public void TestClone(bool expectEquality, string expression) { var result = Build() .AddSpec($@" const obj = {expression}; ") .EvaluateExpressionWithNoErrors("obj"); var hash = Hash(result); var clone = AmbientValueCache.DeepCloneValue(new EvaluationResult(result)); var hashClone = Hash(clone); Assert.Equal(hash, hashClone); if (expectEquality) { XAssert.AreEqual(result, clone.Value, "Expect the cloned values to be equal to the original."); } else { XAssert.AreNotEqual(result, clone.Value, "Expected the cloned value to be a different value."); } }