diff --git a/src/Tests/dotnet-new.Tests/BaseIntegrationTest.cs b/src/Tests/dotnet-new.Tests/BaseIntegrationTest.cs index d9a3400ce769..3d6e39447408 100644 --- a/src/Tests/dotnet-new.Tests/BaseIntegrationTest.cs +++ b/src/Tests/dotnet-new.Tests/BaseIntegrationTest.cs @@ -137,11 +137,15 @@ internal static string InstallTestTemplate(string templateName, ITestOutputHelpe /// /// Packs test template package and returns path to it. /// - internal static string PackTestNuGetPackage(ITestOutputHelper log, [CallerMemberName] string testName = "UnnamedTest") + internal string PackTestNuGetPackage(ITestOutputHelper log, [CallerMemberName] string testName = "UnnamedTest") { - string outputLocation = CreateTemporaryFolder(testName, "TestNuGetPackage"); + var testAsset = _testAssetsManager.CopyTestAsset("dotnet-new", callingMethod: testName, testAssetSubdirectory: "TestPackages").WithSource(); + string testProject = Path.GetFileName(DotnetNewTestTemplatePackageProjectPath); + string testPath = testAsset.Path; - new DotnetPackCommand(log, DotnetNewTestTemplatePackageProjectPath, "-o", outputLocation) + string outputLocation = Path.Combine(testPath, "TestNuGetPackage"); + + new DotnetPackCommand(log, $"{testPath}\\{testProject}", "-o", outputLocation) .Execute() .Should() .Pass(); @@ -184,6 +188,5 @@ private static string GetAndVerifyRepoRoot() } return repoRoot; } - } } diff --git a/src/Tests/dotnet-new.Tests/TemplateDiscoveryTests.cs b/src/Tests/dotnet-new.Tests/TemplateDiscoveryTests.cs index de25bae9722c..8cf9cbac4fa7 100644 --- a/src/Tests/dotnet-new.Tests/TemplateDiscoveryTests.cs +++ b/src/Tests/dotnet-new.Tests/TemplateDiscoveryTests.cs @@ -22,13 +22,12 @@ public TemplateDiscoveryTests(ITestOutputHelper log, TemplateDiscoveryTool templ [Fact] public async Task CanRunDiscoveryTool() { - string home = CreateTemporaryFolder(folderName: "Home"); string testDir = CreateTemporaryFolder(); - string testTemplatesPpackagePath = PackTestNuGetPackage(_log); + string testTemplatesPackagePath = PackTestNuGetPackage(_log); using var packageManager = new PackageManager(); string packagePath = await packageManager.GetNuGetPackage( templatePackName: "Microsoft.Azure.WebJobs.ProjectTemplates", - downloadDirectory: Path.GetDirectoryName(testTemplatesPpackagePath)) + downloadDirectory: Path.GetDirectoryName(testTemplatesPackagePath)) .ConfigureAwait(false); _templateDiscoveryTool.Run(