Skip to content

Commit 04320be

Browse files
committed
Don't make temp test files in bin directory
1 parent 1cbbcfc commit 04320be

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

test/PowerShellEditorServices.Test.E2E/DebugAdapterProtocolMessageTests.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,8 @@ namespace PowerShellEditorServices.Test.E2E
2121
[Trait("Category", "DAP")]
2222
public class DebugAdapterProtocolMessageTests : IAsyncLifetime, IDisposable
2323
{
24-
private const string TestOutputFileName = "__dapTestOutputFile.txt";
2524
private static readonly bool s_isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
26-
private static readonly string s_binDir =
27-
Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
28-
private static readonly string s_testOutputPath = Path.Combine(s_binDir, TestOutputFileName);
25+
private static readonly string s_testOutputPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName(), "__dapTestOutputFile.txt");
2926

3027
private readonly ITestOutputHelper _output;
3128
private DebugAdapterClient PsesDebugAdapterClient;
@@ -116,7 +113,7 @@ public void Dispose()
116113
private static string NewTestFile(string script, bool isPester = false)
117114
{
118115
string fileExt = isPester ? ".Tests.ps1" : ".ps1";
119-
string filePath = Path.Combine(s_binDir, Path.GetRandomFileName() + fileExt);
116+
string filePath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName() + fileExt);
120117
File.WriteAllText(filePath, script);
121118

122119
return filePath;

test/PowerShellEditorServices.Test/Language/SymbolsServiceTests.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using System.Collections.Generic;
55
using System.Linq;
66
using System.Management.Automation;
7-
using System.Runtime.InteropServices;
87
using System.Threading;
98
using System.Threading.Tasks;
109
using Microsoft.Extensions.Logging.Abstractions;
@@ -832,7 +831,7 @@ public void FindsSymbolsInFile()
832831
Assert.True(symbol.IsDeclaration);
833832

834833
// There should be no region symbols unless the provider has been registered.
835-
Assert.Empty(symbols.Where(i => i.Type == SymbolType.Region));
834+
Assert.DoesNotContain(symbols, i => i.Type == SymbolType.Region);
836835
}
837836

838837
[Fact]

0 commit comments

Comments
 (0)