public void TestThrowsUnauthorizedAccessExceptionInCaseOfDirectoryPermissionViolation()
        {
            var @lock     = new FileDistributedLock(new DirectoryInfo(@"C:\Windows\MedallionDistributedLock"), Guid.NewGuid().ToString());
            var exception = Assert.Throws <InvalidOperationException>(() => @lock.TryAcquire()?.Dispose());

            Assert.IsInstanceOf <UnauthorizedAccessException>(exception.InnerException);
            Assert.IsFalse(Directory.Exists(Path.GetDirectoryName(@lock.Name)));
        }
        public void TestThrowsUnauthorizedAccessExceptionInCaseOfFilePermissionViolation()
        {
            var @lock = new FileDistributedLock(new DirectoryInfo(@"C:\Windows"), Guid.NewGuid().ToString());

            Assert.Throws <UnauthorizedAccessException>(() => @lock.TryAcquire()?.Dispose());
        }