Skip to content

Commit

Permalink
Point Publish test to test dotnet location
Browse files Browse the repository at this point in the history
  • Loading branch information
JanKrivanek committed Sep 8, 2022
1 parent b99e5bb commit 2b6b664
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,22 @@

namespace Microsoft.NET.Publish.Tests
{
public class GivenThatWeWantToPublishAClickOnceProject : SdkTest
internal class DotnetEnvironmentTestFixture : IDisposable
{
private readonly string _originalPath;
private const string _PATH_VAR_NAME = "PATH";

public DotnetEnvironmentTestFixture()
{
string dotnetRootUnderTest = TestContext.Current.ToolsetUnderTest.DotNetRoot;
_originalPath = Environment.GetEnvironmentVariable(_PATH_VAR_NAME);
Environment.SetEnvironmentVariable(_PATH_VAR_NAME, dotnetRootUnderTest + Path.PathSeparator + _originalPath);
}

public void Dispose() => Environment.SetEnvironmentVariable(_PATH_VAR_NAME, _originalPath);
}

public class GivenThatWeWantToPublishAClickOnceProject : SdkTest, IClassFixture<DotnetEnvironmentTestFixture>
{
public GivenThatWeWantToPublishAClickOnceProject(ITestOutputHelper log) : base(log)
{
Expand Down

0 comments on commit 2b6b664

Please sign in to comment.