Skip to content

Commit

Permalink
Modify first run tests to all use a different test folder so there's …
Browse files Browse the repository at this point in the history
…no risk of overlap
  • Loading branch information
marcpopMSFT committed Sep 9, 2024
1 parent c1de528 commit 2993393
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ public class DotNetFirstTimeFixture : IDisposable

public Dictionary<string, string> ExtraEnvironmentVariables = new Dictionary<string, string>();

public void Init(ITestOutputHelper log, TestAssetsManager testAssets)
public void Init(ITestOutputHelper log, TestAssetsManager testAssets, [CallerMemberName] string testName = null)
{
if (TestDirectory == null)
{
var dotnetFirstTime = new DotNetFirstTime();

var command = dotnetFirstTime.Setup(log, testAssets, testName: "Dotnet_first_time_experience_tests");
var command = dotnetFirstTime.Setup(log, testAssets, testName: testName ?? "Dotnet_first_time_experience_tests");

FirstDotnetNonVerbUseCommandResult = command.Execute("--info");
FirstDotnetVerbUseCommandResult = command.Execute("new", "--debug:ephemeral-hive");
Expand All @@ -87,16 +87,18 @@ public void Dispose()
public class GivenThatTheUserIsRunningDotNetForTheFirstTime : SdkTest, IClassFixture<DotNetFirstTimeFixture>
{
DotNetFirstTimeFixture _fixture;
ITestOutputHelper _log;

public GivenThatTheUserIsRunningDotNetForTheFirstTime(ITestOutputHelper log, DotNetFirstTimeFixture fixture) : base(log)
{
fixture.Init(log, _testAssetsManager);
_log = log;
_fixture = fixture;
}

[Fact]
public void UsingDotnetForTheFirstTimeSucceeds()
{
_fixture.Init(_log, _testAssetsManager);
_fixture.FirstDotnetVerbUseCommandResult
.Should()
.Pass();
Expand All @@ -105,6 +107,7 @@ public void UsingDotnetForTheFirstTimeSucceeds()
[Fact]
public void UsingDotnetForTheFirstTimeWithNonVerbsDoesNotPrintEula()
{
_fixture.Init(_log, _testAssetsManager);
string firstTimeNonVerbUseMessage = Cli.Utils.LocalizableStrings.DotNetSdkInfoLabel;

_fixture.FirstDotnetNonVerbUseCommandResult.StdOut
Expand All @@ -115,7 +118,7 @@ public void UsingDotnetForTheFirstTimeWithNonVerbsDoesNotPrintEula()
[Fact]
public void ItShowsTheAppropriateMessageToTheUser()
{

_fixture.Init(_log, _testAssetsManager);
var expectedVersion = GetDotnetVersion();
_fixture.FirstDotnetVerbUseCommandResult.StdOut
.Should()
Expand All @@ -130,6 +133,7 @@ public void ItShowsTheAppropriateMessageToTheUser()
[Fact]
public void ItCreatesAFirstUseSentinelFileUnderTheDotDotNetFolder()
{
_fixture.Init(_log, _testAssetsManager);
_fixture.DotDotnetFolder
.Should()
.HaveFile($"{GetDotnetVersion()}.dotnetFirstUseSentinel");
Expand All @@ -138,6 +142,7 @@ public void ItCreatesAFirstUseSentinelFileUnderTheDotDotNetFolder()
[Fact]
public void ItCreatesAnAspNetCertificateSentinelFileUnderTheDotDotNetFolder()
{
_fixture.Init(_log, _testAssetsManager);
_fixture.DotDotnetFolder
.Should()
.HaveFile($"{GetDotnetVersion()}.aspNetCertificateSentinel");
Expand Down

0 comments on commit 2993393

Please sign in to comment.