public void TestWriteUnlock() { var testDir = new DirectoryInfo(Path.Combine(tempDir.FullName, Guid.NewGuid().ToString())); testDir.Create(); var locker = new DirectoryLocker(testDir.FullName); locker.WriteLock(); Assert.AreEqual(1, testDir.GetFiles("write*.lock").Count()); locker.WriteUnlock(); Assert.AreEqual(0, testDir.GetFiles("write*.lock").Count()); }
private void WriteUnLock(DirectoryLocker locker, int waitSeconds) { Thread.Sleep(waitSeconds * 1000); locker.WriteUnlock(); }