public async Task AddOrUpdateAsyncTest() { DictionaryChange change = null; TransactedConcurrentDictionary <int, string> d = new TransactedConcurrentDictionary <int, string>( new Uri("test://mocks", UriKind.Absolute), (c) => { change = c; return(true); } ); using (var tx = _stateManager.CreateTransaction()) { await d.AddOrUpdateAsync(tx, 1, (k) => "One", (k, v) => "Two"); Assert.IsNull(change); await tx.CommitAsync(); Assert.AreEqual("One", change.Added); } change = null; using (var tx = _stateManager.CreateTransaction()) { await d.AddOrUpdateAsync(tx, 1, (k) => "One", (k, v) => "Two"); Assert.IsNull(change); await tx.CommitAsync(); Assert.AreEqual("Two", change.Added); } }