public void GetRecursive()
        {
            var x        = new object();
            var y        = new object();
            var settings = PropertiesSettings.GetOrCreate();
            var rec      = TrackerCache.GetOrAdd(x, y, settings, p => new Recursive(p, settings));

            Assert.AreSame(rec, rec.Value.Next);
        }
        public void GetOrAddUsingReferencePair()
        {
            var x    = new object();
            var y    = new object();
            var pair = ReferencePair.GetOrCreate(x, y);

            Assert.AreEqual(pair.Count, 1);
            var settings = PropertiesSettings.GetOrCreate(ReferenceHandling.Structural);

            using (var created = TrackerCache.GetOrAdd(x, y, settings, p => p))
            {
                Assert.AreSame(pair, created.Value);
                Assert.AreEqual(pair.Count, 2);
            }

            Assert.AreEqual(1, pair.Count);

            pair.Dispose();
            Assert.AreEqual(0, pair.Count);
        }
 public Recursive(IRefCounted <ReferencePair> pair, MemberSettings settings)
 {
     this.Next = TrackerCache.GetOrAdd(pair.Value.X, pair.Value.Y, settings, x => new Recursive(x, settings));
 }