Skip to content

Commit 52eb1c3

Browse files
committed
Use GetTempPath to create a temp dir for tests.
1 parent 414196b commit 52eb1c3

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

CLI.Tests/ParserConfig.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ public void ReadMalformedJSON()
7878
public void HandleExceptionReadingInvalidJSON()
7979
{
8080
// Arrange
81-
var path = Environment.CurrentDirectory + Path.DirectorySeparatorChar + "MSPCTests_" + new Random().NextDouble().ToString();
82-
using (StreamWriter w = new StreamWriter(path))
81+
var parserFilename = Path.GetTempPath() + Guid.NewGuid().ToString() + ".json";
82+
using (StreamWriter w = new StreamWriter(parserFilename))
8383
w.WriteLine("abc");
8484

8585
string rep1Path = Path.GetTempPath() + Guid.NewGuid().ToString() + ".bed";
@@ -91,7 +91,7 @@ public void HandleExceptionReadingInvalidJSON()
9191
string logFile;
9292
using (var o = new Orchestrator())
9393
{
94-
o.Orchestrate(string.Format("-i {0} -i {1} -r bio -w 1e-2 -s 1e-4 -p {2}", rep1Path, rep2Path, path).Split(' '));
94+
o.Orchestrate(string.Format("-i {0} -i {1} -r bio -w 1e-2 -s 1e-4 -p {2}", rep1Path, rep2Path, parserFilename).Split(' '));
9595
logFile = o.LogFile;
9696
}
9797

@@ -178,9 +178,7 @@ public void DoesNotEqualToANullObject()
178178
public void ThrowExceptionForInvalidCultureValue()
179179
{
180180
// Arrange
181-
var parserFilename =
182-
Environment.CurrentDirectory + Path.DirectorySeparatorChar +
183-
Guid.NewGuid().ToString() + ".json";
181+
var parserFilename = Path.GetTempPath() + Guid.NewGuid().ToString() + ".json";
184182

185183
// Create an json file with a `culture` field containing
186184
// invalid culture name.

0 commit comments

Comments
 (0)