예제 #1
0
            public void WhenFileIsNotLocked_ThenReturnFalse()
            {
                var fileInfo = FileBuilder.InFileSystem.WithPath(Path.Combine(WorkingDir, "Test1.txt")).Build();

                var result = FileLocker.IsLocked(fileInfo);

                Assert.That(result, Is.False);
            }
예제 #2
0
            public void WhenFileIsLocked_ThenUnlock()
            {
                var fileInfo = FileBuilder.InFileSystem.WithPath(Path.Combine(WorkingDir, "Test1.txt")).Build();

                FileLocker.Lock(fileInfo);

                FileLocker.Unlock(fileInfo);

                Assert.That(FileLocker.IsLocked(fileInfo), Is.False);
            }
예제 #3
0
 public void WhenFileDoesNotExist_ThenThrowException()
 {
     Assert.Throws <FileNotFoundException>(() => FileLocker.IsLocked(FileNotExist));
 }
예제 #4
0
 public void WhenFileInfoIsNull_ThenThrowException()
 {
     Assert.Throws <ArgumentNullException>(() => FileLocker.IsLocked(null as FileInfo));
 }
예제 #5
0
 public void WhenIsNullOrEmpty_ThenThrowException(string filePath)
 {
     Assert.Throws <ArgumentException>(() => FileLocker.IsLocked(filePath));
 }