Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions test/dotnet.Tests/CommandTests/Run/RunParserTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,23 @@

namespace Microsoft.DotNet.Tests.ParserTests
{
public class RunParserTests
public class RunParserTests : IDisposable
{
private readonly ITestOutputHelper output;
private readonly string _previousWorkingDirectory;

public RunParserTests(ITestOutputHelper output)
{
this.output = output;

// Reset current working directory after tests run to avoid breaking other tests
_previousWorkingDirectory = Directory.GetCurrentDirectory();
}

private readonly ITestOutputHelper output;
public void Dispose()
{
Directory.SetCurrentDirectory(_previousWorkingDirectory);
}

[Fact]
public void RunParserCanGetArgumentFromDoubleDash()
Expand All @@ -21,9 +30,8 @@ public void RunParserCanGetArgumentFromDoubleDash()
var testAsset = tam.CopyTestAsset("HelloWorld").WithSource();
var newWorkingDir = testAsset.Path;

Directory.SetCurrentDirectory(newWorkingDir);
var projectPath = Path.Combine(newWorkingDir, "HelloWorld.csproj");

var runCommand = RunCommand.FromArgs(new[] { "--project", projectPath, "--", "foo" });
runCommand.ApplicationArgs.Single().Should().Be("foo");
}
Expand Down
Loading