public void MassUpdate_PreviousMassUpdateNotDisposed_ThrowsInvalidOperationException() { var dictionaryUnderTest = new ObservableDictionary <int, int>(); dictionaryUnderTest.BeginMassUpdate(); Assert.Throws <InvalidOperationException>(() => { dictionaryUnderTest.BeginMassUpdate(); }); }
public void MassUpdateTest() { var target = new ObservableDictionary <int, string>(); bool hitChange = false; target.CollectionChanged += (s, e) => { hitChange = true; }; using (target.BeginMassUpdate()) { target[1] = "Hello"; target[2] = "World"; target[3] = "Testing.."; Assert.IsFalse(hitChange); } Assert.IsTrue(hitChange); }