Skip to content

Commit

Permalink
Update TestTempFile.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
Bykiev committed Jan 3, 2024
1 parent f03e78d commit 4e11700
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions testcases/main/Util/TestTempFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,18 @@ public void TestCreateTempFile()

string tempDirPath = Path.GetDirectoryName(fileInfo.FullName);

if (Directory.Exists(tempDirPath))
if(Directory.Exists(tempDirPath))
Directory.Delete(tempDirPath, true);

Assert.IsFalse(File.Exists(fileInfo.FullName));
Assert.IsFalse(Directory.Exists(tempDirPath));

Assert.DoesNotThrow(() => TempFile.CreateTempFile("test2", ".xls"));
FileInfo file = null;
Assert.DoesNotThrow(() => file = TempFile.CreateTempFile("test2", ".xls"));
Assert.IsTrue(Directory.Exists(tempDirPath));

if(file !=null && file.Exists)
file.Delete();
}

[Test]
Expand All @@ -40,13 +44,17 @@ public void TestGetTempFilePath()

string tempDirPath = Path.GetDirectoryName(path);

if (Directory.Exists(tempDirPath))
if(Directory.Exists(tempDirPath))
Directory.Delete(tempDirPath, true);

Assert.IsFalse(Directory.Exists(tempDirPath));

Assert.DoesNotThrow(() => TempFile.GetTempFilePath("test", ".xls"));
string fileName = "";
Assert.DoesNotThrow(() => fileName = TempFile.GetTempFilePath("test", ".xls"));
Assert.IsTrue(Directory.Exists(tempDirPath));

if(File.Exists(fileName))
File.Delete(fileName);
}
}
}

0 comments on commit 4e11700

Please sign in to comment.