/// <summary> /// Expect changes in the specified vector. /// </summary> /// <param name="hvo"></param> /// <param name="tag"></param> /// <param name="message">inserted into any Assert for bad value</param> /// <param name="newValue"></param> public void ExpectVector(int hvo, int tag, int[] newValue, string message) { ReplaceVecInfo info = new ReplaceVecInfo(hvo, tag, message, newValue); m_allowedProps.Add(info); m_newVecVals.Add(info); }
void SetupNewObjectMap() { if (m_unmappedNewObjectIds.Count == 0) { return; // no new objects to map } List <NewValInfo> tryAgain = new List <NewValInfo>(); tryAgain.AddRange(m_newVecVals.ToArray()); tryAgain.AddRange(m_newAtomicVals.ToArray()); while (tryAgain.Count != 0) { List <NewValInfo> tryNow = tryAgain; tryAgain = new List <NewValInfo>(); foreach (NewValInfo eachNewVal in tryNow) { if (IsNewObjectId(eachNewVal.hvo) && !m_newObjectSubstitutions.ContainsKey(eachNewVal.hvo)) { // property OF a new object we haven't found elsewhere...we can't deal with it. tryAgain.Add(eachNewVal); continue; } int hvoSrc = MapObjectId(eachNewVal.hvo, 0); if (eachNewVal is ReplaceAtomicInfo) { int val = (eachNewVal as ReplaceAtomicInfo).newVal; int expected = m_sda.get_ObjectProp(hvoSrc, eachNewVal.tag); MapObjectId(val, expected); } else { ReplaceVecInfo info = eachNewVal as ReplaceVecInfo; int chvo = m_sda.get_VecSize(hvoSrc, info.tag); Assert.AreEqual(info.newVal.Length, chvo, info.message + " (length)"); for (int i = 0; i < chvo; i++) { int expected = m_sda.get_VecItem(hvoSrc, info.tag, i); MapObjectId(info.newVal[i], expected); } } } if (tryAgain.Count == tryNow.Count) { Assert.Fail("could not resolve all new object IDs"); } } }