public void DecrementExistingReference() { ConcurrentDictionary <string, int> refCountByName = new ConcurrentDictionary <string, int>(); ReferenceCounting.IncrementReference(refCountByName, "memes"); ReferenceCounting.DecrementReference(refCountByName, "memes"); Assert.AreEqual(0, refCountByName["memes"]); }
public void TryDecrementInvalidReference() { // Doesn't throw exception. ConcurrentDictionary <string, int> refCountByName = new ConcurrentDictionary <string, int>(); ReferenceCounting.DecrementReference(refCountByName, "memes"); Assert.IsFalse(refCountByName.ContainsKey("memes")); }