Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolayPianikov committed Jul 19, 2024
1 parent 912f1af commit 9830523
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion CSharpInteractive.Tests/UsageScenarios/BaseScenario.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@ public class BaseScenario : IHost, IDisposable

public BaseScenario()
{
Composition.Shared.Root.TestEnvironment.IsTesting = true;
Composition.Shared.Root.TestEnvironment.ExitCode = default;
_tempDir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()[..4]);
Directory.CreateDirectory(_tempDir);
_prevCurDir = Environment.CurrentDirectory;
Environment.CurrentDirectory = _tempDir;
}

public int ExpectedExitCode { get; set; }

// ReSharper disable once MemberCanBeProtected.Global
public IHost Host => this;

Expand Down Expand Up @@ -82,6 +85,9 @@ void IDisposable.Dispose()
}

Environment.CurrentDirectory = _prevCurDir;
Composition.Shared.Root.TestEnvironment.ExitCode.ShouldBe(0);
if (Composition.Shared.Root.TestEnvironment.ExitCode is { } exitCode)
{
exitCode.ShouldBe(ExpectedExitCode);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public void Run()
{
Skip.IfNot(Environment.OSVersion.Platform == PlatformID.Win32NT);
Skip.IfNot(string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("TEAMCITY_VERSION")));
ExpectedExitCode = 1;

// $visible=true
// $tag=10 Command Line API
Expand Down

0 comments on commit 9830523

Please sign in to comment.