Skip to content
Merged
Changes from 1 commit
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
22 changes: 11 additions & 11 deletions test/dotnet-new.IntegrationTests/DotnetNewTestTemplatesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class DotnetNewTestTemplatesTests : BaseIntegrationTest

private static readonly ImmutableArray<string> SupportedTargetFrameworks =
[
"net10.0",
ToolsetInfo.CurrentTargetFramework
];

private static readonly (string ProjectTemplateName, string ItemTemplateName, string[] Languages, bool SupportsTestingPlatform)[] AvailableItemTemplates =
Expand Down Expand Up @@ -52,7 +52,7 @@ static DotnetNewTestTemplatesTests()
{
string templatePackagePath = Path.Combine(
RepoTemplatePackages,
"Microsoft.DotNet.Common.ProjectTemplates.10.0",
"Microsoft.DotNet.Common.ProjectTemplates." + ToolsetInfo.CurrentTargetFrameworkVersion,
"content");

var dummyLog = new NullTestOutputHelper();
Expand All @@ -66,7 +66,7 @@ static DotnetNewTestTemplatesTests()
.WithCustomHive(CreateTemporaryFolder(folderName: "Home"))
.WithWorkingDirectory(CreateTemporaryFolder())
.Execute()
.Should().ExitWith(0);
.Should().Pass();
}

[Theory]
Expand All @@ -83,16 +83,16 @@ public void ItemTemplate_CanBeInstalledAndTestArePassing(string targetFramework,
.WithCustomHive(outputDirectory).WithRawArguments()
.WithWorkingDirectory(workingDirectory)
.Execute()
.Should().ExitWith(0);
.Should().Pass();

var itemName = "test";

// Add test item to test project: dotnet new <itemTemplate> -n <test> -lang <language> -o <testProjectName>
// Add test item to test project: dotnet new <itemTemplate> -n <test> -lang <language> -o <outputDirectory>
new DotnetNewCommand(_log, $"{itemTemplate} -n {itemName} -lang {language} -o {outputDirectory}")
.WithCustomHive(outputDirectory).WithRawArguments()
.WithWorkingDirectory(workingDirectory)
.Execute()
.Should().ExitWith(0);
.Should().Pass();

if (language == Languages.FSharp)
{
Expand All @@ -106,7 +106,7 @@ public void ItemTemplate_CanBeInstalledAndTestArePassing(string targetFramework,
.WithWorkingDirectory(outputDirectory)
.Execute(outputDirectory);

result.Should().ExitWith(0);
result.Should().Pass();

result.StdOut.Should().Contain("Passed!");
result.StdOut.Should().MatchRegex(@"Passed:\s*2");
Expand All @@ -129,15 +129,15 @@ public void ProjectTemplate_CanBeInstalledAndTestsArePassing(string targetFramew
.WithCustomHive(outputDirectory).WithRawArguments()
.WithWorkingDirectory(workingDirectory)
.Execute()
.Should().ExitWith(0);
.Should().Pass();

if (runDotnetTest)
{
var result = new DotnetTestCommand(_log, false)
.WithWorkingDirectory(outputDirectory)
.Execute(outputDirectory);

result.Should().ExitWith(0);
result.Should().Pass();

result.StdOut.Should().Contain("Passed!");
result.StdOut.Should().MatchRegex(@"Passed:\s*1");
Expand Down Expand Up @@ -167,15 +167,15 @@ public void MSTestAndPlaywrightProjectTemplate_WithCoverageToolAndTestRunner_Can
.WithCustomHive(outputDirectory).WithRawArguments()
.WithWorkingDirectory(workingDirectory)
.Execute()
.Should().ExitWith(0);
.Should().Pass();

if (runDotnetTest)
{
var result = new DotnetTestCommand(_log, false)
.WithWorkingDirectory(outputDirectory)
.Execute(outputDirectory);

result.Should().ExitWith(0);
result.Should().Pass();

result.StdOut.Should().Contain("Passed!");
result.StdOut.Should().MatchRegex(@"Passed:\s*1");
Expand Down