public void Test1() { Locks locks = Locks.Instance; TableKey tk1 = new TableKey(1, 1); TableKey tk2 = new TableKey(1, 1); Lockey lock1 = new Lockey(tk1); Lockey lock2 = new Lockey(tk2); Assert.AreEqual(lock1, lock2); Lockey lock1ref = locks.Get(lock1); Assert.IsTrue(lock1ref == lock1); // first Get. self Lockey lock2ref = locks.Get(lock2); Assert.IsTrue(lock2ref == lock1); // second Get. the exist TableKey tk3 = new TableKey(1, 2); Lockey lock3 = new Lockey(tk3); Lockey lock3ref = locks.Get(lock3); Assert.IsTrue(lock3ref == lock3); Assert.IsFalse(lock3ref == lock1); }