public void TestMutexIsLocked()
 {
     using (MutexLock lck = new MutexLock(Guid.NewGuid().ToString()))
     {
         Assert.IsTrue(lck.IsLocked);
         lck.Dispose();
         Assert.IsFalse(lck.IsLocked);
     }
 }
        public void TestMutexAbandond()
        {
            using (Mutex mtx = new Mutex())
            {
                Thread t = new Thread(
                    delegate()
                    { GC.KeepAlive(new MutexLock(1, mtx)); }
                    );
                t.Start();
                t.Join();

                //So the previous thread abandoned the mutex...
                using (MutexLock lck = new MutexLock(mtx))
                {
                    Assert.IsTrue(lck.WasAbandonded);
                    Assert.AreEqual(mtx, lck.MutexHandle);
                }
            }
        }
 public void TestMutexIsNew()
 {
     using (MutexLock lck = new MutexLock(Guid.NewGuid().ToString()))
         Assert.IsTrue(lck.WasNew);
 }