public void TestReplace(bool track) { var events = 0; var acc = new Accumulator("test"); var dic = new TrackableDictionary <string, int>(acc, track) { { "one", 1 }, { "two", 2 } }; var other = new TrackableDictionary <string, int>() { { "three", 3 }, { "four", 4 } }; dic.CollectionChanged += (s, e) => { events++; Assert.AreEqual(e.Action, NotifyCollectionChangedAction.Replace); }; dic.Replace(other); Assert.AreEqual(1, events); Assert.AreEqual(2, other.Count); foreach (var o in other) { Assert.IsTrue(dic.Contains(o)); } if (track) { Assert.AreEqual(3, acc.Records.Count); } else { Assert.AreEqual(0, acc.Records.Count); } }