public void OpenFileStream_Throws_Exception_With_Filepath() { var fakePath = Guid.NewGuid().ToString(); var opener = new RetryableFileOpener(); var ex = Assert.Throws <IOException>(() => opener.OpenFileStream(fakePath, 0, FileMode.Open, FileAccess.ReadWrite, FileShare.None)); Assert.True(ex.Message.Contains(fakePath)); }
public void OpenFileStream_Directory_DoesNotExists_ShouldCreate() { var folder = TestUtilities.PreparePath(Path.Combine(Environment.CurrentDirectory, Guid.NewGuid().ToString(), Guid.NewGuid().ToString())); try { var opener = new RetryableFileOpener(); var filePath = Path.Combine(folder, "file.js"); using (opener.OpenFileStream(filePath, 2, FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite)) { } Assert.True(File.Exists(filePath)); } finally { Directory.Delete(folder, true); } }