Acquisition\InstallSidecarWriterTests.cs (14)
15var sidecarPath = Path.Combine(workspace.Path, InstallSidecarReader.SidecarFileName);
28using var update = InstallSidecarWriter.PrepareForSelfUpdate(workspace.Path, "staging");
44Assert.Empty(Directory.GetFiles(workspace.Path, $"{InstallSidecarReader.SidecarFileName}.*.tmp"));
52using var update = InstallSidecarWriter.PrepareForSelfUpdate(workspace.Path, "daily");
54var sidecarPath = Path.Combine(workspace.Path, InstallSidecarReader.SidecarFileName);
63var sidecarPath = Path.Combine(workspace.Path, InstallSidecarReader.SidecarFileName);
67Assert.ThrowsAny<JsonException>(() => InstallSidecarWriter.PrepareForSelfUpdate(workspace.Path, "staging"));
70Assert.Empty(Directory.GetFiles(workspace.Path, $"{InstallSidecarReader.SidecarFileName}.*.tmp"));
77var sidecarPath = Path.Combine(workspace.Path, InstallSidecarReader.SidecarFileName);
86() => InstallSidecarWriter.PrepareForSelfUpdate(workspace.Path, "staging"));
90Assert.Empty(Directory.GetFiles(workspace.Path, $"{InstallSidecarReader.SidecarFileName}.*.tmp"));
97var sidecarPath = Path.Combine(workspace.Path, InstallSidecarReader.SidecarFileName);
101InstallSidecarWriter.PrepareForSelfUpdate(workspace.Path, "staging")!.Dispose();
104Assert.Empty(Directory.GetFiles(workspace.Path, $"{InstallSidecarReader.SidecarFileName}.*.tmp"));
Acquisition\InstallSourceDetectorTests.cs (14)
47File.WriteAllText(Path.Combine(workspace.Path, InstallSidecarReader.SidecarFileName), sidecar);
49var detector = CreateDetector(Path.Combine(workspace.Path, "aspire"), TestEnvironment.CreateLinux());
74var detector = CreateDetector(Path.Combine(workspace.Path, "dotnet"), environment);
91var detector = CreateDetector(Path.Combine(workspace.Path, "aspire"), environment);
102var processPath = Path.Combine(workspace.Path, "aspire.exe");
114Assert.Empty(Directory.GetFiles(workspace.Path));
125var detector = CreateDetector(Path.Combine(workspace.Path, "aspire"), TestEnvironment.CreateLinux(), registry);
138var detector = CreateDetector(Path.Combine(workspace.Path, "aspire.exe"), TestEnvironment.CreateWindows(), registry);
161var processPath = Path.Combine(workspace.Path, relativePath.Replace('/', Path.DirectorySeparatorChar));
181[variable] = Path.Combine(workspace.Path, root) + Path.DirectorySeparatorChar
183var processPath = Path.Combine(workspace.Path, relativePath.Replace('/', Path.DirectorySeparatorChar));
220var processPath = Path.Combine(workspace.Path, "MISE", "INSTALLS", "ASPIRE", "13.5.0", windows ? "ASPIRE.EXE" : "aspire");
253var processPath = Path.Combine(workspace.Path, relativePath.Replace('/', Path.DirectorySeparatorChar));
268var linkPath = Path.Combine(workspace.Path, "aspire");
Agents\LocalAspireSkillsTests.cs (8)
31var before = Directory.GetFileSystemEntries(_context.Workspace.Path, "*", SearchOption.AllDirectories).Order().ToArray();
38Assert.Equal(before, Directory.GetFileSystemEntries(_context.Workspace.Path, "*", SearchOption.AllDirectories).Order());
57var before = Directory.GetFileSystemEntries(_context.Workspace.Path, "*", SearchOption.AllDirectories).Order().ToArray();
66Assert.Equal(before, Directory.GetFileSystemEntries(_context.Workspace.Path, "*", SearchOption.AllDirectories).Order());
204Path.Combine(_context.Workspace.Path, directory, "skills", "aspire", "SKILL.md"), "outside the workspace");
205var before = Directory.GetFileSystemEntries(_context.Workspace.Path, "*", SearchOption.AllDirectories).Order().ToArray();
212Assert.Equal(before, Directory.GetFileSystemEntries(_context.Workspace.Path, "*", SearchOption.AllDirectories).Order());
222await AgentConfigurationTestContext.WriteAsync(Path.Combine(_context.Workspace.Path, ".agents", "skills", "aspire", "SKILL.md"), "ancestor");
BundleServiceComputeDefaultExtractDirTests.cs (7)
32var prefixDir = Path.Combine(workspace.Path, "aspire");
55var prDir = Path.Combine(workspace.Path, "dogfood", "pr-12345");
76var installDir = Path.Combine(workspace.Path, "WindowsApps", "Microsoft.Aspire_8wekyb3d8bbwe");
103var cellarDir = Path.Combine(workspace.Path, "Caskroom", "aspire", "13.2.0");
109var brewBinDir = Path.Combine(workspace.Path, "bin");
131workspace.Path,
160var prefixDir = Path.Combine(workspace.Path, "nix", "store", "aspire");
Commands\AddCommandTests.cs (40)
37var appHostFile = new FileInfo(Path.Combine(workspace.Path, "apphost.ts"));
50File.WriteAllText(Path.Combine(workspace.Path, "nuget.config"), $$"""
62File.WriteAllText(Path.Combine(workspace.Path, AspireConfigFile.FileName), """
175NuGetTestHelper.GetEligiblePackageSources(workspace.Path, added.PackageId));
266var appHostFile = new FileInfo(Path.Combine(workspace.Path, "AppHost.csproj"));
268File.WriteAllText(Path.Combine(workspace.Path, AspireConfigFile.FileName), configuredSources ? """
277var configPath = Path.Combine(workspace.Path, "nuget.config");
343var settings = NuGetTestHelper.LoadSettings(workspace.Path);
351Assert.Equal(eligibleSources, NuGetTestHelper.GetEligiblePackageSources(workspace.Path, packageId));
352Assert.Equal([sdkSource], NuGetTestHelper.GetEligiblePackageSources(workspace.Path, "Aspire.AppHost.Sdk"));
353Assert.Equal([PackageSources.NuGetOrg], NuGetTestHelper.GetEligiblePackageSources(workspace.Path, "Newtonsoft.Json"));
390new PackageSourceProvider(NuGetTestHelper.LoadSettings(workspace.Path)).LoadPackageSources()
445var appHostFile = new FileInfo(Path.Combine(workspace.Path, "apphost.ts"));
447File.WriteAllText(Path.Combine(workspace.Path, AspireConfigFile.FileName), $$"""
453"source": {{JsonSerializer.Serialize(Path.Combine(workspace.Path, "missing"))}},
523var appHostFile = new FileInfo(Path.Combine(workspace.Path, "apphost.ts"));
525File.WriteAllText(Path.Combine(workspace.Path, AspireConfigFile.FileName), """
632File.WriteAllText(Path.Combine(workspace.Path, AspireConfigFile.FileName), """
678var appHostFile = new FileInfo(Path.Combine(workspace.Path, "apphost.ts"));
680File.WriteAllText(Path.Combine(workspace.Path, AspireConfigFile.FileName), $$"""
688var configPath = Path.Combine(workspace.Path, "nuget.config");
734Assert.Equal([source], NuGetTestHelper.GetEligiblePackageSources(workspace.Path, added.PackageId));
735Assert.Equal([source], NuGetTestHelper.GetEligiblePackageSources(workspace.Path, existingPattern.TrimEnd('*') + "Dependency"));
736Assert.Equal(["https://example.com/sdk"], NuGetTestHelper.GetEligiblePackageSources(workspace.Path, "Aspire.Hosting.Redis"));
737var settings = NuGetTestHelper.LoadSettings(workspace.Path);
760var appHostFile = new FileInfo(Path.Combine(workspace.Path, "apphost.ts"));
762File.WriteAllText(Path.Combine(workspace.Path, AspireConfigFile.FileName), """
769File.WriteAllText(Path.Combine(workspace.Path, "nuget.config"), $$"""
835NuGetTestHelper.GetEligiblePackageSources(workspace.Path, packageId));
837configurations.Add(new XElement(id, XDocument.Load(Path.Combine(workspace.Path, "nuget.config")).Root));
850var appHostFile = new FileInfo(Path.Combine(workspace.Path, "apphost.ts"));
852File.WriteAllText(Path.Combine(workspace.Path, AspireConfigFile.FileName), """
855var configPath = Path.Combine(workspace.Path, "nuget.config");
915var configPath = Path.Combine(workspace.Path, "nuget.config");
972.AddScrubber(builder => builder.Replace(workspace.Path, "<workspace>").Replace('\\', '/'));
1194File.WriteAllText(Path.Combine(workspace.Path, AspireConfigFile.FileName), """
1197File.WriteAllText(Path.Combine(workspace.Path, "nuget.config"), """
1260await Verify(await File.ReadAllTextAsync(Path.Combine(workspace.Path, "nuget.config")), "xml").UseParameters(specifyVersion);
4024var appHostFile = new FileInfo(Path.Combine(workspace.Path, "apphost.ts"));
4026File.WriteAllText(Path.Combine(workspace.Path, AspireConfigFile.FileName), """{"channel":"staging"}""");
Commands\CompletionsCommandTests.cs (9)
263"legacy-local" => ConfigurationHelper.BuildPathToSettingsJsonFile(workspace.Path),
264_ => Path.Combine(workspace.Path, AspireConfigFile.FileName)
273var originalFiles = Directory.GetFiles(workspace.Path, "*", SearchOption.AllDirectories)
275var originalDirectories = Directory.GetDirectories(workspace.Path, "*", SearchOption.AllDirectories).Order().ToArray();
277options.StartInfo.WorkingDirectory = workspace.Path;
318Assert.Equal(originalFiles.Keys.Order(), Directory.GetFiles(workspace.Path, "*", SearchOption.AllDirectories).Order());
319Assert.Equal(originalDirectories, Directory.GetDirectories(workspace.Path, "*", SearchOption.AllDirectories).Order());
333var settingsPath = Path.Combine(workspace.Path, AspireConfigFile.FileName);
337options.StartInfo.WorkingDirectory = workspace.Path;
Commands\ConfigSourceCommandTests.cs (39)
44Repository = Path.Combine(workspace.Path, "missing-repository"),
101Repository = Path.Combine(workspace.Path, "missing-repository"),
194var projectFile = new FileInfo(Path.Combine(workspace.Path, "apphost.cs"));
285await File.WriteAllTextAsync(Path.Combine(workspace.Path, "Test.sln"), "Fake solution file");
333Assert.False(File.Exists(Path.Combine(workspace.Path, AspireConfigFile.FileName)));
334var appHostConfigPath = Path.Combine(workspace.Path, "Test.AppHost", AspireConfigFile.FileName);
342$"agent init --workspace-root \"{workspace.Path}\" --agents {agent} --scope project --skills aspire --non-interactive");
349Assert.False(File.Exists(Path.Combine(workspace.Path, AspireConfigFile.FileName)));
401var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
439var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
453var projectFile = new FileInfo(Path.Combine(workspace.Path, "apphost.cs"));
533var rootPath = Path.Combine(workspace.Path, AspireConfigFile.FileName);
556Assert.Equal("version-2", AspireConfigFile.Load(workspace.Path)!.ConfigSource!.AppliedVersion);
584var localPath = Path.Combine(workspace.Path, AspireConfigFile.FileName);
599$"update --config-source --apphost \"{Path.Combine(workspace.Path, requestedPath)}\" --yes --non-interactive");
620var parentPath = Path.Combine(workspace.Path, AspireConfigFile.FileName);
661var localPath = Path.Combine(workspace.Path, AspireConfigFile.FileName);
665await File.WriteAllTextAsync(Path.Combine(workspace.Path, "apphost.cs"), "#:sdk Aspire.AppHost.Sdk");
679var appHostArgument = explicitAppHost ? $" --apphost \"{Path.Combine(workspace.Path, "apphost.cs")}\"" : "";
706var configPath = Path.Combine(workspace.Path, AspireConfigFile.FileName);
769Assert.Equivalent(expectedSource, AspireConfigFile.Load(workspace.Path)!.ConfigSource, strict: true);
836var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
839await File.WriteAllTextAsync(Path.Combine(workspace.Path, "AppHost.csproj"), "<Project />");
909Assert.Equal(bound || childConfigExists ? s_source.AppliedVersion : "version-1", AspireConfigFile.Load(workspace.Path)!.ConfigSource!.AppliedVersion);
926var parentPath = Path.Combine(workspace.Path, AspireConfigFile.FileName);
964Path.Combine(workspace.Path, AspireConfigFile.FileName), "appHost.path", "selected/apphost.cs");
991var parentPath = Path.Combine(workspace.Path, AspireConfigFile.FileName);
1060var missingProject = Path.Combine(workspace.Path, "missing.csproj");
1113var output = Path.Combine(workspace.Path, "created-project");
1120await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", AspireConfigFile.FileName), "{}");
1137Assert.False(File.Exists(Path.Combine(workspace.Path, AspireConfigFile.FileName)));
1154Assert.Equivalent(accepted ? s_source : new ConfigSource { OptOut = true }, AspireConfigFile.Load(workspace.Path)!.ConfigSource, strict: true);
1155var configuration = JsonNode.Parse(await File.ReadAllTextAsync(Path.Combine(workspace.Path, AspireConfigFile.FileName)))!;
1157Assert.True(File.Exists(Path.Combine(workspace.Path, "apphost.cs")));
1170var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
1199await File.WriteAllTextAsync(Path.Combine(workspace.Path, "Test.sln"), "Fake solution file");
1200var childPath = Path.Combine(workspace.Path, "Test.AppHost");
1202var rootConfigPath = Path.Combine(workspace.Path, AspireConfigFile.FileName);
1352var output = Path.Combine(workspace.Path, "created-project");
Commands\InitCommandTests.cs (21)
38await File.WriteAllTextAsync(Path.Combine(workspace.Path, "Test.sln"), "Fake solution file");
40var configPath = Path.Combine(workspace.Path, "nuget.config");
73Assert.False(File.Exists(Path.Combine(workspace.Path, "apphost.cs")));
74Assert.False(Directory.Exists(Path.Combine(workspace.Path, "Test.AppHost")));
168await File.WriteAllTextAsync(Path.Combine(workspace.Path, "Test.sln"), "Fake solution file");
187Assert.True(Directory.Exists(Path.Combine(workspace.Path, "Test.AppHost")));
189[Path.Combine(workspace.Path, ".github", "copilot", "settings.json")],
191Assert.False(Directory.Exists(Path.Combine(workspace.Path, ".agents", "skills")));
192Assert.False(File.Exists(Path.Combine(workspace.Path, AspireConfigFile.FileName)));
580await File.WriteAllTextAsync(Path.Combine(workspace.Path, "apphost.mts"), "console.log('existing AppHost');");
583var originalFiles = Directory.GetFiles(workspace.Path, "*", SearchOption.AllDirectories)
626var projectFiles = Directory.GetFiles(workspace.Path, "*", SearchOption.AllDirectories).Where(path => path != logFilePath);
830File.WriteAllText(Path.Combine(workspace.Path, "go.mod"), moduleContent);
831File.WriteAllText(Path.Combine(workspace.Path, "go.work"), workspaceContent);
832File.WriteAllText(Path.Combine(workspace.Path, "main.go"), sourceContent);
861Assert.Equal(moduleContent, File.ReadAllText(Path.Combine(workspace.Path, "go.mod")));
862Assert.Equal(workspaceContent, File.ReadAllText(Path.Combine(workspace.Path, "go.work")));
863Assert.Equal(sourceContent, File.ReadAllText(Path.Combine(workspace.Path, "main.go")));
864Assert.Equal("module apphost\n\ngo 1.26\n", File.ReadAllText(Path.Combine(workspace.Path, "aspire-apphost", "go.mod")));
867File.ReadAllText(Path.Combine(workspace.Path, "aspire-apphost", "go.work")));
868var config = AspireConfigFile.Load(workspace.Path);
Commands\NewCommandLocalTemplateTests.ConfiguredGitSourceObjects.cs (10)
84var root = Path.GetRelativePath(workspace.Path, destination.FullName);
108["local"] = Path.Combine(workspace.Path, "local")
145path = templatePath == "absolute" ? workspace.Path : templatePath
147["working"] = Path.Combine(workspace.Path, "local")
166var link = Path.Combine(workspace.Path, "template-link");
169Directory.CreateSymbolicLink(link, Path.Combine(workspace.Path, "local"));
189["working"] = Path.Combine(workspace.Path, "local")
213Assert.True(File.Exists(Path.Combine(workspace.Path, "local", "TemplateApp.txt")));
226Path.GetRelativePath(workspace.Path, Path.Combine(destination.FullName, "templates/sample")),
400outputs[label] = ReadOutput(Path.Combine(workspace.Path, "out", label));
Commands\NewCommandLocalTemplateTests.ConfiguredGitSources.cs (10)
126Assert.Equal("Remote: Hello", await File.ReadAllTextAsync(Path.Combine(workspace.Path, "out", "Demo.txt")));
157await File.ReadAllTextAsync(Path.Combine(workspace.Path, $"out{invocation}", "Demo.txt")));
206Assert.False(Directory.Exists(Path.Combine(workspace.Path, "out")));
225["local-source"] = Path.Combine(workspace.Path, "local"),
335["local-source"] = Path.Combine(workspace.Path, "local"),
493Assert.Equal("Directory: Hello", await File.ReadAllTextAsync(Path.Combine(workspace.Path, "out", "Demo.txt")));
557await CreateSearchTemplateAsync(workspace, Path.GetRelativePath(workspace.Path, destination.FullName),
593await File.ReadAllTextAsync(Path.Combine(workspace.Path, "out", "Demo.txt")));
660Assert.False(Directory.Exists(Path.Combine(workspace.Path, "out")));
667Path.GetRelativePath(workspace.Path, destination.FullName), "sample", "Sample template", marker);
Commands\NewCommandLocalTemplateTests.ConfiguredSources.cs (25)
43await WriteConfiguredSourcesAsync(provider, new() { ["company"] = Path.Combine(workspace.Path, "template") });
49Assert.Equal("Found: Hello", await File.ReadAllTextAsync(Path.Combine(workspace.Path, "out", "Demo.txt")));
164"working": { "path": {{JsonSerializer.Serialize(workspace.Path)}} },
204await WriteConfiguredSourcesAsync(provider, new() { [sourceName] = workspace.Path });
217await WriteConfiguredSourcesAsync(provider, new() { ["company"] = workspace.Path });
218await File.WriteAllTextAsync(Path.Combine(workspace.Path, "aspire.config.json"),
224Assert.Equal(workspace.Path, source.Value.Template?.Path);
242["first-source"] = Path.Combine(workspace.Path, "first"),
243["second-source"] = Path.Combine(workspace.Path, "second")
264await WriteConfiguredSourcesAsync(provider, new() { ["examples"] = Path.Combine(workspace.Path, "template") });
289["missing"] = Path.Combine(workspace.Path, "missing"),
291["working"] = Path.Combine(workspace.Path, "valid")
323await WriteConfiguredSourcesAsync(provider, new() { ["company"] = workspace.Path });
362["second-source"] = new { path = Path.Combine(workspace.Path, "second"), displayName = "Company [templates]" },
363["first-source"] = new { path = Path.Combine(workspace.Path, "first"), displayName = "Company [templates]" }
401await WriteConfiguredSourcesAsync(provider, new() { ["company"] = Path.Combine(workspace.Path, "template") });
439await WriteConfiguredSourcesAsync(provider, new() { ["missing"] = Path.Combine(workspace.Path, "missing") });
452Assert.False(Directory.Exists(Path.Combine(workspace.Path, "out")));
550.Parse(["config", "set", "templateSources.company.path", workspace.Path, "--global"])
556Assert.Equal(workspace.Path, source.Value.Template?.Path);
594Assert.False(Directory.Exists(Path.Combine(workspace.Path, "out")));
604await WriteConfiguredSourcesAsync(provider, new() { ["company"] = workspace.Path });
634await WriteConfiguredSourcesAsync(provider, new() { ["company"] = Path.Combine(workspace.Path, "templates") });
650await WriteConfiguredSourcesAsync(provider, new() { ["company"] = Path.Combine(workspace.Path, "template") });
692await File.WriteAllTextAsync(Path.Combine(workspace.Path, directory, "TemplateApp.txt"), $"{marker}: GreetingValue");
Commands\NewCommandLocalTemplateTests.cs (70)
48await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", "greeting.txt"), "GreetingValue");
102await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", "features.txt"), "FeaturesValue");
209Assert.Equal(ReadOutput(Path.Combine(workspace.Path, "non-interactive-out")), ReadOutput(workspace));
271await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", "settings.txt"), "Mode: [ModeValue]\n");
377Assert.Equal(!useDatabase, Directory.Exists(Path.Combine(workspace.Path, "out")));
413await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", "settings.txt"),
459await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", "settings.txt"),
494Assert.False(Directory.Exists(Path.Combine(workspace.Path, "out")));
520await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", "settings.txt"), "First: FirstValue\nSecond: SecondValue\n");
547await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", ".git"), "gitdir: ../git-storage");
555await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", ".gitignore"), "bin/");
556await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", ".gitattributes"), "* text=auto");
559var originalSource = ReadOutput(Path.Combine(workspace.Path, "template"));
569Assert.Equal(originalSource, ReadOutput(Path.Combine(workspace.Path, "template")));
581var templatePath = Path.Combine(workspace.Path, templateDirectory);
677outputCreated = File.Exists(Path.Combine(workspace.Path, "out", "Demo.cs"));
721await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", "aspire.config.json"), """
742using var generatedConfig = JsonDocument.Parse(await File.ReadAllTextAsync(Path.Combine(workspace.Path, "out", "aspire.config.json")));
821var outputPath = Path.Combine(workspace.Path, "out");
836.AddScrubber(builder => builder.Replace('\\', '/').Replace(workspace.Path.Replace('\\', '/'), "{workspace}"))
866var outputPath = Path.Combine(workspace.Path, "out");
871.AddScrubber(builder => builder.Replace('\\', '/').Replace(workspace.Path.Replace('\\', '/'), "{workspace}"))
885var templateConfigPath = Path.Combine(workspace.Path, "template", "nuget.config");
886var targetConfigPath = Path.Combine(workspace.Path, "template", fileName);
952var outputPath = Path.Combine(workspace.Path, "out");
967.AddScrubber(builder => builder.Replace('\\', '/').Replace(workspace.Path.Replace('\\', '/'), "{workspace}"))
979var sourceConfigPath = Path.Combine(workspace.Path, "template", "nuget.config");
990foreach (var file in Directory.EnumerateFiles(Path.Combine(workspace.Path, "template"), "*", SearchOption.AllDirectories))
992var target = Path.Combine(destination.FullName, Path.GetRelativePath(Path.Combine(workspace.Path, "template"), file));
1011Assert.Equal(ownedConfig, await File.ReadAllTextAsync(Path.Combine(workspace.Path, "out", "nuget.config")));
1016ReadOutput(Path.Combine(workspace.Path, "template")).Keys);
1019var cachedTemplate = Assert.Single(Directory.GetDirectories(Path.Combine(workspace.Path, ".aspire", "cache", "git")));
1021ReadOutput(Path.Combine(workspace.Path, "template")),
1044Assert.False(Directory.Exists(Path.Combine(workspace.Path, "out")));
1086Assert.False(File.Exists(Path.Combine(workspace.Path, "out", "nuget.config")));
1096Assert.Equal("Template content", await File.ReadAllTextAsync(Path.Combine(workspace.Path, "out", "nuget.config", "keep.txt")));
1124var config = XDocument.Load(Path.Combine(workspace.Path, "out", "nuget.config"));
1140await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", ".template.config", "aspirecli.host.json"), "{}");
1151Assert.False(Directory.Exists(Path.Combine(workspace.Path, "out")));
1198Assert.False(Directory.Exists(Path.Combine(workspace.Path, "out")));
1217await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", ".template.config", "template.json"), "{ not json");
1221await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template"), "not a directory");
1231Assert.False(Directory.Exists(Path.Combine(workspace.Path, "out")));
1258await File.WriteAllTextAsync(Path.Combine(workspace.Path, "out", "existing.txt"), "Keep me");
1297Assert.Equal("second", await File.ReadAllTextAsync(Path.Combine(workspace.Path, "out", "identity.txt")));
1303Assert.False(Directory.Exists(Path.Combine(workspace.Path, "out")));
1336Assert.False(Directory.Exists(Path.Combine(workspace.Path, "out")));
1354Assert.False(Directory.Exists(Path.Combine(workspace.Path, "out")));
1371["new", "--template-path", Path.Combine(workspace.Path, "template"), "--name", "Demo", "--output", "out", "--suppress-agent-init"])
1448await CreateTemplateAsync(workspace, Path.GetRelativePath(workspace.Path, Path.Combine(destination.FullName, "template")));
1518Assert.False(Directory.Exists(Path.Combine(workspace.Path, "out")));
1540templatePath == "absolute" ? workspace.Path : templatePath,
1546Assert.False(Directory.Exists(Path.Combine(workspace.Path, "out")));
1556var linkPath = Path.Combine(workspace.Path, "template-link");
1559Directory.CreateSymbolicLink(linkPath, workspace.Path);
1585Assert.False(Directory.Exists(Path.Combine(workspace.Path, "out")));
1589Assert.True(Directory.Exists(workspace.Path));
1616Assert.False(Directory.Exists(Path.Combine(workspace.Path, "out")));
1637await CreateTemplateAsync(workspace, Path.GetRelativePath(workspace.Path, Path.Combine(destination.FullName, "template")));
1757outputs[label] = ReadOutput(Path.Combine(workspace.Path, "out", label));
1769await CreateTemplateAsync(workspace, Path.GetRelativePath(workspace.Path, Path.Combine(destination.FullName, "one")));
1770await CreateTemplateAsync(workspace, Path.GetRelativePath(workspace.Path, Path.Combine(destination.FullName, "two")));
1827await CreateTemplateAsync(workspace, Path.GetRelativePath(workspace.Path, Path.Combine(destination.FullName, "template")));
2019await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", "nuget.config"), """
2031await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", "aspire.config.json"), """
2064await File.WriteAllTextAsync(Path.Combine(workspace.Path, "nuget.config"), """
2090await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", "aspire.config.json"),
2095ReadOutput(Path.Combine(workspace.Path, "out"));
2127await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", "settings.txt"), "Mode: [ModeValue]\n");
2167await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", "settings.txt"),
Commands\NewCommandLocalTemplateTests.HostConfiguration.cs (17)
32var config = Path.Combine(workspace.Path, "template", ".template.config");
90await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", ".template.config", "aspirecli.host.json"), """
156await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", "settings.json"),
170using var settings = JsonDocument.Parse(await File.ReadAllTextAsync(Path.Combine(workspace.Path, "out", "settings.json")));
186await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", ".template.config", "aspirecli.host.json"), """
202Assert.False(Directory.Exists(Path.Combine(workspace.Path, "out")));
222var config = Path.Combine(workspace.Path, "template", ".template.config");
234Assert.False(Directory.Exists(Path.Combine(workspace.Path, "out")));
242await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", ".template.config", "aspirecli.host.json"), """
265await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", ".template.config", "aspirecli.host.json"), """
296var hostFile = Path.Combine(workspace.Path, "template", ".template.config", "aspirecli.host.json");
306await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", "aspire.config.json"), """
313await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", "apphost.mts"),
340var config = Path.Combine(workspace.Path, "template", ".template.config");
348await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", "aspire.config.json"), "{}");
371var output = Path.Combine(workspace.Path, "out");
439var output = Path.Combine(workspace.Path, "out");
Commands\NewCommandLocalTemplateTests.InitConfig.cs (14)
50await WriteConfiguredSourcesAsync(provider, new() { ["personal"] = workspace.Path });
81var localPath = Path.Combine(workspace.Path, AspireConfigFile.FileName);
82await WriteConfiguredSourcesAsync(provider, new() { ["Enterprise"] = workspace.Path });
96Assert.Equal(new TemplateSource(workspace.Path, null, null), sources.Single(source => source.Key == "Enterprise").Value.Template);
106await store.AddAsync("SHARED", new JsonObject { ["path"] = workspace.Path, ["displayName"] = "Personal templates" }, default);
107Assert.Equal(new TemplateSource(workspace.Path, null, null),
143"templateSources": { "enterprise": { "path": {{JsonSerializer.Serialize(Path.Combine(workspace.Path, "enterprise"))}}, "displayName": "Team [templates]" } },
152["personal"] = new { path = Path.Combine(workspace.Path, "personal"), displayName = "Team [templates]" }
170var projectConfig = Path.Combine(workspace.Path, "out", AspireConfigFile.FileName);
172Assert.Equal("Enterprise: Hello", await File.ReadAllTextAsync(Path.Combine(workspace.Path, "out", "Demo.txt")));
204await WriteConfiguredSourcesAsync(provider, new() { ["personal"] = Path.Combine(workspace.Path, "personal") });
218await Verify(await File.ReadAllTextAsync(Path.Combine(workspace.Path, "out", AspireConfigFile.FileName)), "json");
219Assert.Equal("Personal: Hello", await File.ReadAllTextAsync(Path.Combine(workspace.Path, "out", "Demo.txt")));
226var localPath = Path.Combine(workspace.Path, AspireConfigFile.FileName);
Commands\NewCommandLocalTemplateTests.NuGetValues.cs (32)
42await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", "NuGet.Config"), """
61Assert.Empty(Directory.GetFileSystemEntries(workspace.Path, ".aspire-template-*"));
90await File.WriteAllTextAsync(Path.Combine(workspace.Path, "NuGet.Config"), config);
95await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", "AppHost", "nuget.config"),
97await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", "nuget.config"),
105await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", "nuget.config"), config);
109await File.WriteAllTextAsync(Path.Combine(workspace.Path, "NuGet.Config"),
111var host = Path.Combine(workspace.Path, "template", ".template.config", "aspirecli.host.json");
136var output = Path.Combine(workspace.Path, "out");
165Assert.False(Directory.Exists(Path.Combine(workspace.Path, "out")));
200Assert.Equal(existingOutput, Directory.Exists(Path.Combine(workspace.Path, "out")));
203Assert.Empty(Directory.GetFileSystemEntries(Path.Combine(workspace.Path, "out")));
205Assert.Empty(Directory.GetFileSystemEntries(workspace.Path, ".aspire-template-*"));
232Assert.False(Directory.Exists(Path.Combine(workspace.Path, "out")));
233Assert.Empty(Directory.GetFileSystemEntries(workspace.Path, ".aspire-template-*"));
243await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", "nuget.config"), """
260Assert.False(Directory.Exists(Path.Combine(workspace.Path, "out")));
261Assert.Empty(Directory.GetFileSystemEntries(workspace.Path, ".aspire-template-*"));
273var path = Path.Combine(workspace.Path, "template", ".template.config", "template.json");
288Assert.False(Directory.Exists(Path.Combine(workspace.Path, "out")));
303var path = Path.Combine(workspace.Path, "template", ".template.config", "template.json");
335Assert.Equal(enabled, File.Exists(Path.Combine(workspace.Path, "out", "versions.json")));
347var config = Path.Combine(workspace.Path, "template", ".template.config");
390var config = Path.Combine(workspace.Path, "template", ".template.config");
409Assert.False(Directory.Exists(Path.Combine(workspace.Path, "out")));
436Assert.False(Directory.Exists(Path.Combine(workspace.Path, "out")));
437Assert.Empty(Directory.GetFileSystemEntries(workspace.Path, ".aspire-template-*"));
466Assert.Empty(Directory.GetFileSystemEntries(workspace.Path, ".aspire-template-*"));
477var config = Path.Combine(workspace.Path, "template", ".template.config");
494await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", "preliminary-only.txt"), "Placeholder render only");
495await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", "versions.json"),
539await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", "versions.json"),
Commands\NewCommandLocalTemplateTests.PromptDefaults.cs (7)
126var templatePath = Path.Combine(workspace.Path, "template", ".template.config", "template.json");
129var hostPath = Path.Combine(workspace.Path, "template", ".template.config", "aspirecli.host.json");
224Assert.False(Directory.Exists(Path.Combine(workspace.Path, "out")));
236var hostPath = Path.Combine(workspace.Path, "template", ".template.config", "aspirecli.host.json");
251Assert.False(Directory.Exists(Path.Combine(workspace.Path, "out")));
259var templatePath = Path.Combine(workspace.Path, "template", ".template.config", "template.json");
326await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", "names.txt"),
Commands\TemplateSourceStartupTests.cs (25)
50var projectPath = Path.Combine(workspace.Path, AspireConfigFile.FileName);
56RunStartup(home.FullName, workspace.Path, arguments);
76var projectPath = Path.Combine(workspace.Path, AspireConfigFile.FileName);
82RunStartup(home.FullName, workspace.Path, arguments, exitCode);
100var projectPath = Path.Combine(workspace.Path, AspireConfigFile.FileName);
116RunStartup(home.FullName, workspace.Path, arguments, CliExitCodes.Success);
130File.WriteAllText(Path.Combine(workspace.Path, AspireConfigFile.FileName),
133RunStartup(home.FullName, workspace.Path,
138RunStartup(home.FullName, workspace.Path, "config info", CliExitCodes.Success);
139RunStartup(home.FullName, workspace.Path,
159File.WriteAllText(Path.Combine(workspace.Path, AspireConfigFile.FileName),
164RunStartup(home.FullName, workspace.Path, "template source list", CliExitCodes.InvalidCommand);
182options.StartInfo.WorkingDirectory = workspace.Path;
233options.StartInfo.WorkingDirectory = workspace.Path;
285File.WriteAllText(Path.Combine(workspace.Path, AspireConfigFile.FileName),
288RunStartup(home.FullName, workspace.Path, $"config set {key} {value} --global", CliExitCodes.Success);
294RunStartup(home.FullName, workspace.Path, "new --help", CliExitCodes.Success);
308File.WriteAllText(Path.Combine(workspace.Path, AspireConfigFile.FileName),
311RunStartup(home.FullName, workspace.Path, "config delete features.defaultWatchEnabled --global", CliExitCodes.Success);
327RunStartup(home.FullName, workspace.Path, "config set appHost.path apphost.cs", CliExitCodes.Success);
329var migrated = AspireConfigFile.Load(workspace.Path);
345File.WriteAllText(Path.Combine(workspace.Path, AspireConfigFile.FileName),
348RunStartup(home.FullName, workspace.Path, "--version", CliExitCodes.Success);
353RunStartup(home.FullName, workspace.Path, "config set channel stable --global", CliExitCodes.Success);
354RunStartup(home.FullName, workspace.Path, "config get channel", CliExitCodes.Success);
Commands\UpdateCommandTests.cs (14)
379var appHost = new FileInfo(Path.Combine(workspace.Path, "apphost.ts"));
381var configPath = Path.Combine(workspace.Path, AspireConfigFile.FileName);
387var serverProject = new FakeFailingAppHostServerProject(workspace.Path);
2255Path.Combine(workspace.Path, AspireConfigFile.FileName), """{ "channel": "staging" }""");
2714Path.Combine(workspace.Path, AspireConfigFile.FileName),
2895Path.Combine(workspace.Path, AspireConfigFile.FileName),
2921? Path.Combine(workspace.Path, AspireConfigFile.FileName)
2922: Path.Combine(workspace.Path, ".aspire", "settings.global.json");
2981"parent" => Path.Combine(workspace.Path, AspireConfigFile.FileName),
2982"legacy" => Path.Combine(workspace.Path, ".aspire", "settings.json"),
2983_ => Path.Combine(workspace.Path, ".aspire", "settings.global.json")
2989Path.Combine(workspace.Path, ".aspire", "settings.global.json"), """{ "channel": "daily" }""");
3018await File.WriteAllTextAsync(Path.Combine(workspace.Path, AspireConfigFile.FileName),
3040Path.Combine(workspace.Path, AspireConfigFile.FileName), """{ "channel": "unknown-channel" }""");
Configuration\ConfigSourceServiceGitTests.cs (56)
51var source = new ConfigSource { Repository = workspace.Path, Path = AspireConfigFile.FileName };
67var error = await Assert.ThrowsAsync<ConfigSourceException>(() => client.AcquireAsync(source, workspace.Path, TestContext.Current.CancellationToken));
94var source = new ConfigSource { Repository = workspace.Path, Path = AspireConfigFile.FileName };
104var error = await Assert.ThrowsAsync<ConfigSourceException>(() => client.AcquireAsync(source, workspace.Path, TestContext.Current.CancellationToken, time));
148var source = new ConfigSource { Repository = workspace.Path, Path = AspireConfigFile.FileName };
151: client.AcquireAsync(source, workspace.Path, cancellation.Token, time);
197var pidFile = Path.Combine(workspace.Path, "child.pid");
294var startInfo = client.CreateStartInfo(workspace.Path, ["fetch"], GitCommandMode.Unattended);
319var startInfo = client.CreateStartInfo(workspace.Path, ["fetch", "--depth", "1", "--", "https://example.com/configuration", "HEAD"], GitCommandMode.Interactive);
344var startInfo = runner.CreateStartInfo(workspace.Path, ["ls-remote", "--", "repository", "HEAD"], GitCommandMode.Interactive);
363var startInfo = client.CreateStartInfo(workspace.Path, [command], GitCommandMode.Interactive);
389var source = new ConfigSource { Repository = workspace.Path, Path = path };
395Assert.Equal((await RunGitOutputAsync(workspace.Path, ["rev-parse", $"HEAD:{path}"])).Trim(), version);
412await RunGitOutputAsync(workspace.Path, ["clone", "--", workspace.Path, repository.FullName]);
441var source = new ConfigSource { Repository = workspace.Path, Path = AspireConfigFile.FileName };
475new() { Repository = workspace.Path, Path = AspireConfigFile.FileName },
506new() { Repository = workspace.Path, Path = AspireConfigFile.FileName }, workspace.CreateDirectory("cache").FullName, TestContext.Current.CancellationToken));
516new() { Repository = workspace.Path, Path = AspireConfigFile.FileName }, workspace.CreateDirectory("cache").FullName, TestContext.Current.CancellationToken));
528var originalBranch = (await RunGitOutputAsync(workspace.Path, ["branch", "--show-current"])).Trim();
529await GitTestHelper.RunGitAsync(workspace.Path, outputHelper, "checkout", "-b", "config/preview");
530await File.WriteAllTextAsync(Path.Combine(workspace.Path, AspireConfigFile.FileName), """{"custom":"preview"}""");
531await GitTestHelper.RunGitAsync(workspace.Path, outputHelper, "commit", "-am", "Preview configuration");
532var expectedCommit = (await RunGitOutputAsync(workspace.Path, ["rev-parse", "HEAD"])).Trim();
533await GitTestHelper.RunGitAsync(workspace.Path, outputHelper, "checkout", originalBranch);
537new() { Repository = workspace.Path, Path = AspireConfigFile.FileName, Ref = reference },
549var expectedCommit = (await RunGitOutputAsync(workspace.Path, ["rev-parse", "HEAD"])).Trim();
550await File.WriteAllTextAsync(Path.Combine(workspace.Path, AspireConfigFile.FileName), """{"custom":"latest"}""");
551await GitTestHelper.RunGitAsync(workspace.Path, outputHelper, "commit", "-am", "New configuration");
555new() { Repository = workspace.Path, Path = AspireConfigFile.FileName, Ref = expectedCommit },
567var source = new ConfigSource { Repository = workspace.Path, Path = AspireConfigFile.FileName };
575await File.WriteAllTextAsync(Path.Combine(workspace.Path, "unrelated.txt"), "Unrelated change");
576await GitTestHelper.RunGitAsync(workspace.Path, outputHelper, "add", "unrelated.txt");
577await GitTestHelper.RunGitAsync(workspace.Path, outputHelper, "commit", "-m", "Unrelated commit");
583await File.WriteAllTextAsync(Path.Combine(workspace.Path, AspireConfigFile.FileName), "invalid JSON is not read during a version check");
584await GitTestHelper.RunGitAsync(workspace.Path, outputHelper, "commit", "-am", "Change configuration");
613new() { Repository = workspace.Path, Path = AspireConfigFile.FileName, Ref = reference },
626await File.WriteAllTextAsync(Path.Combine(workspace.Path, AspireConfigFile.FileName), content);
627await GitTestHelper.RunGitAsync(workspace.Path, outputHelper, "add", AspireConfigFile.FileName);
630var entry = await RunGitOutputAsync(workspace.Path, ["ls-files", "--stage", AspireConfigFile.FileName]);
632await GitTestHelper.RunGitAsync(workspace.Path, outputHelper, "update-index", "--cacheinfo", $"120000,{objectId},{AspireConfigFile.FileName}");
633await GitTestHelper.RunGitAsync(workspace.Path, outputHelper, "commit", "-m", "Add symlink configuration");
636var source = new ConfigSource { Repository = workspace.Path, Path = AspireConfigFile.FileName };
664var originalCommit = (await RunGitOutputAsync(workspace.Path, ["rev-parse", "HEAD"])).Trim();
665var originalVersion = (await RunGitOutputAsync(workspace.Path, ["rev-parse", $"HEAD:{AspireConfigFile.FileName}"])).Trim();
666var branch = (await RunGitOutputAsync(workspace.Path, ["branch", "--show-current"])).Trim();
669Repository = workspace.Path,
700await File.WriteAllTextAsync(Path.Combine(workspace.Path, AspireConfigFile.FileName), """{"custom":"updated"}""", token);
701await GitTestHelper.RunGitAsync(workspace.Path, outputHelper, "commit", "-am", "Update configuration");
702var expectedCommit = selector == "commit" ? originalCommit : (await RunGitOutputAsync(workspace.Path, ["rev-parse", "HEAD"])).Trim();
703var expectedVersion = selector == "commit" ? originalVersion : (await RunGitOutputAsync(workspace.Path, ["rev-parse", $"HEAD:{AspireConfigFile.FileName}"])).Trim();
724await GitTestHelper.RunGitAsync(workspace.Path, outputHelper, "init", $"--object-format={objectFormat}");
725await GitTestHelper.ConfigureGitIdentityAsync(workspace.Path, outputHelper);
726var configPath = Path.Combine(workspace.Path, path.Replace('/', Path.DirectorySeparatorChar));
729await GitTestHelper.RunGitAsync(workspace.Path, outputHelper, "add", "--", path);
730await GitTestHelper.RunGitAsync(workspace.Path, outputHelper, "commit", "-m", "Add configuration");
Configuration\ConfigSourceServiceTests.cs (40)
89Assert.False(File.Exists(Path.Combine(workspace.Path, AspireConfigFile.FileName)));
160Assert.False(File.Exists(Path.Combine(workspace.Path, AspireConfigFile.FileName)));
186Assert.False(File.Exists(Path.Combine(workspace.Path, AspireConfigFile.FileName)));
220var parentPath = Path.Combine(workspace.Path, AspireConfigFile.FileName);
400var rootPath = Path.Combine(workspace.Path, AspireConfigFile.FileName);
578new DirectoryInfo(workspace.Path + Path.DirectorySeparatorChar), CancellationToken.None);
647var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
756var repository = System.IO.Path.Combine(workspace.Path, "local\nrepository");
828Assert.False(File.Exists(Path.Combine(workspace.Path, AspireConfigFile.FileName)));
1118Assert.False(File.Exists(Path.Combine(workspace.Path, AspireConfigFile.FileName)));
1125var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
1134Assert.True(AspireConfigFile.Load(workspace.Path)!.ConfigSource!.OptOut);
1146var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
1172var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
1208var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
1242Assert.False(File.Exists(Path.Combine(workspace.Path, AspireConfigFile.FileName)));
1251var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
1283await Verify(await File.ReadAllTextAsync(Path.Combine(workspace.Path, AspireConfigFile.FileName)), "json");
1315var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
1336var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
1358var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
1372var config = AspireConfigFile.Load(workspace.Path)!;
1387var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
1410var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
1436var config = AspireConfigFile.Load(workspace.Path)!;
1447var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
1469var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
1524var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
1829var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
1861var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
1891Assert.Equivalent(s_appliedSource, AspireConfigFile.Load(workspace.Path)!.ConfigSource, strict: true);
1920Assert.Equivalent(changed, AspireConfigFile.Load(workspace.Path)!.ConfigSource, strict: true);
1928var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
1951var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
1985var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
2056Assert.Equivalent(invalid, AspireConfigFile.Load(workspace.Path)!.ConfigSource, strict: true);
2079var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
2143Assert.Equal("version-2", AspireConfigFile.Load(workspace.Path)!.ConfigSource!.AppliedVersion);
2164Assert.Equal("version-1", AspireConfigFile.Load(workspace.Path)!.ConfigSource!.AppliedVersion);
2196Assert.False(File.Exists(Path.Combine(workspace.Path, AspireConfigFile.FileName)));
Configuration\ConfigurationHelperTests.cs (28)
25var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
26var target = Path.Combine(workspace.Path, "shared.json");
42Assert.Equal(dangling ? [path] : [path, target], Directory.GetFiles(workspace.Path).Order(StringComparer.Ordinal));
51var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
63Assert.Equal(2, Directory.GetFiles(workspace.Path).Length);
70Assert.Equal([path], Directory.GetFiles(workspace.Path));
77var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
85Assert.Equal([path], Directory.GetFiles(workspace.Path));
103targetDirectory = Path.Combine(workspace.Path, "linked-shared");
131var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
132var targetPath = Path.Combine(workspace.Path, "shared", AspireConfigFile.FileName);
139Assert.Equal(path, Assert.Single(Directory.GetFiles(workspace.Path)));
147var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
148var otherPath = Path.Combine(workspace.Path, "other.json");
157Assert.Equal(2, Directory.GetFiles(workspace.Path).Length);
173var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
184Assert.Equal(path, Assert.Single(Directory.GetFiles(workspace.Path)));
197var file = new FileInfo(Path.Combine(workspace.Path, AspireConfigFile.FileName));
210Assert.Equal(file.FullName, Assert.Single(Directory.GetFiles(workspace.Path)));
330"legacy-local" => ConfigurationHelper.BuildPathToSettingsJsonFile(workspace.Path),
331_ => Path.Combine(workspace.Path, AspireConfigFile.FileName)
353var originalFiles = Directory.GetFiles(workspace.Path, "*", SearchOption.AllDirectories)
377Assert.Equal(originalFiles.Keys.Order(), Directory.GetFiles(workspace.Path, "*", SearchOption.AllDirectories).Order());
565var settingsPath = Path.Combine(workspace.Path, AspireConfigFile.FileName);
579var globalSettingsFile = new FileInfo(Path.Combine(workspace.Path, "global-settings.json"));
585var config = AspireConfigFile.Load(workspace.Path)!;
600var settingsPath = Path.Combine(workspace.Path, AspireConfigFile.FileName);
621var globalSettingsFile = new FileInfo(Path.Combine(workspace.Path, "global-settings.json"));
DotNet\DotNetAppHostNuGetConfigMergerTests.cs (17)
76File.WriteAllText(Path.Combine(workspace.Path, AspireConfigFile.FileName), $$"""
84NuGetTestHelper.CreateService().GetNuGetSettings(workspace.Path, TestContext.Current.CancellationToken).Sources,
97Assert.Equal([feed.FullName], NuGetTestHelper.GetEligiblePackageSources(workspace.Path, packageId));
98Assert.Equal([team.FullName], NuGetTestHelper.GetEligiblePackageSources(workspace.Path, "Contoso.Hosting.Keep"));
99Assert.Equal([team.FullName], NuGetTestHelper.GetEligiblePackageSources(workspace.Path, "Contoso.Internal.Dependency"));
100Assert.Equal([sdk.FullName], NuGetTestHelper.GetEligiblePackageSources(workspace.Path, "Aspire.Hosting.AppHost"));
101Assert.Equal([publicFeed.FullName], NuGetTestHelper.GetEligiblePackageSources(workspace.Path, "Unrelated.Package"));
106sources: [], nugetConfigPaths: [config.FullName], workingDirectory: workspace.Path,
116.AddScrubber(builder => builder.Replace(workspace.Path, "<workspace>").Replace('\\', '/'))
184File.WriteAllText(Path.Combine(workspace.Path, AspireConfigFile.FileName), $$"""
283? new[] { Path.Combine(appHostDirectory.FullName, "NuGet.Config"), Path.Combine(workspace.Path, "nuget.config") }
284: [Path.Combine(workspace.Path, "nuget.config")];
412Assert.Equal([source], NuGetTestHelper.GetEligiblePackageSources(workspace.Path, "Private.Library"));
413Assert.Equal([source], NuGetTestHelper.GetEligiblePackageSources(workspace.Path, "Aspire.Hosting"));
1911Assert.Equal([privateSource], NuGetTestHelper.GetEligiblePackageSources(workspace.Path, "Aspire.Hosting.Redis"));
2100Assert.Empty(service.GetNuGetSettings(workspace.Path, TestContext.Current.CancellationToken).DisabledPackageSourceKeys);
2102NuGetTestHelper.GetEligiblePackageSources(workspace.Path, "Aspire.Hosting.Redis"));
Git\GitClientTests.cs (6)
40Assert.Equal(workspace.Path, command.WorkingDirectory.FullName);
114var repository = new GitRepositoryLocation(new DirectoryInfo(Path.Combine(workspace.Path, "repository.git")), IsBare: true);
125Assert.Equal(workspace.Path, command.WorkingDirectory.FullName);
159Assert.Equal([$"--git-dir={workspace.Path}", "ls-tree", "-z", objectId, "--", path], command.Arguments);
192command => Assert.Equal([$"--git-dir={workspace.Path}", "cat-file", "-s", objectId], command.Arguments),
193command => Assert.Equal([$"--git-dir={workspace.Path}", "cat-file", "blob", objectId], command.Arguments));
Git\GitCommandRunnerTests.Authentication.cs (28)
52var marker = Path.Combine(workspace.Path, "askpass-called");
53var helper = Path.Combine(workspace.Path, "askpass.sh");
61var config = Path.Combine(workspace.Path, "gitconfig");
66var info = runner.CreateStartInfo(workspace.Path, ["ls-remote", "--", server.Repository], mode);
67IsolateGit(info, workspace.Path, config);
99var marker = Path.Combine(workspace.Path, "credential-operations");
100var helper = Path.Combine(workspace.Path, "credential.sh");
108var config = Path.Combine(workspace.Path, "gitconfig");
112var info = runner.CreateStartInfo(workspace.Path, ["ls-remote", "--", server.Repository], GitCommandMode.Unattended);
113IsolateGit(info, workspace.Path, config);
176var config = Path.Combine(workspace.Path, "gitconfig");
181var info = runner.CreateStartInfo(workspace.Path, arguments, GitCommandMode.Unattended);
182IsolateGit(info, workspace.Path, config);
212var config = Path.Combine(workspace.Path, "gitconfig");
218var info = runner.CreateStartInfo(workspace.Path, arguments, GitCommandMode.Unattended);
219IsolateGit(info, workspace.Path, config);
276var directory = Directory.CreateDirectory(Path.Combine(workspace.Path,
278var config = Path.Combine(workspace.Path, "gitconfig");
286IsolateGit(info, workspace.Path, config);
301var config = Path.Combine(workspace.Path, "gitconfig");
303var executables = Directory.CreateDirectory(Path.Combine(workspace.Path, "Git child executables"));
308var info = runner.CreateStartInfo(workspace.Path, arguments, GitCommandMode.Unattended);
309IsolateGit(info, workspace.Path, config);
330var config = Path.Combine(workspace.Path, "gitconfig");
335var info = runner.CreateStartInfo(workspace.Path, arguments, GitCommandMode.Unattended);
336IsolateGit(info, workspace.Path, config);
365var gitDirectory = Path.Combine(workspace.Path, "git-directory");
366var absolute = Path.Combine(workspace.Path, "absolute");
Npm\AspireJsLauncherTests.cs (9)
25var layout = CreateFakeNpmLayout(workspace.Path, pointerVersion, rid, ridPackageName, ridPackageVersion);
43var layout = CreateFakeNpmLayout(workspace.Path, pointerVersion, rid, ridPackageName, pointerVersion);
64var layout = CreateFakeNpmLayout(workspace.Path, pointerVersion, rid, ridPackageName, pointerVersion);
66var monkeyPatchScript = Path.Combine(workspace.Path, "patch-chmod.js");
93var layout = CreateFakeNpmLayout(workspace.Path, pointerVersion, rid, ridPackageName, pointerVersion);
95var monkeyPatchScript = Path.Combine(workspace.Path, "patch-copy.js");
122var layout = CreateFakeNpmLayout(workspace.Path, pointerVersion, rid, ridPackageName, pointerVersion);
150var probeScript = Path.Combine(workspace.Path, "detect-rids.js");
169var probeScript = Path.Combine(workspace.Path, "detect-current-rid.js");
NuGet\BundleNuGetServiceTests.cs (14)
40var configPath = Path.Combine(inherited ? workspace.Path : app.FullName, "nuget.config");
64new TestConfigurationService { SettingsFilePath = Path.Combine(workspace.Path, "global.json") });
118File.WriteAllText(Path.Combine(workspace.Path, AspireConfigFile.FileName), invalidConfiguration ? """
123File.WriteAllText(Path.Combine(workspace.Path, "nuget.config"), """
130new TestConfigurationService { SettingsFilePath = Path.Combine(workspace.Path, "global.json") });
155var global = new FileInfo(Path.Combine(workspace.Path, "global.json"));
159File.WriteAllText(Path.Combine(workspace.Path, "nuget.config"), """
167var protectedSettings = service.GetNuGetSettings(workspace.Path, TestContext.Current.CancellationToken);
170service.GetNuGetSettings(workspace.Path, TestContext.Current.CancellationToken).CacheIdentity);
173var unprotectedSettings = service.GetNuGetSettings(workspace.Path, TestContext.Current.CancellationToken);
193File.WriteAllText(Path.Combine(workspace.Path, "nuget.config"), """
199new TestConfigurationService { SettingsFilePath = Path.Combine(workspace.Path, "global.json") });
239new TestConfigurationService { SettingsFilePath = Path.Combine(workspace.Path, "global.json") });
303new TestConfigurationService { SettingsFilePath = Path.Combine(workspace.Path, "global.json") });
NuGet\NuGetClientTests.cs (13)
53workingDirectory: workspace.Path, TestContext.Current.CancellationToken);
119workingDirectory: workspace.Path, TestContext.Current.CancellationToken);
134await File.WriteAllTextAsync(Path.Combine(workspace.Path, "nuget.config"), """
142"example.package", workspace.Path, TestContext.Current.CancellationToken);
155await File.WriteAllTextAsync(Path.Combine(workspace.Path, "nuget.config"), $$"""
169"Example.Package", workspace.Path, TestContext.Current.CancellationToken);
178await File.WriteAllTextAsync(Path.Combine(workspace.Path, "nuget.config"),
182"Aspire.Hosting.Dotnet", workspace.Path, TestContext.Current.CancellationToken);
411var configPath = Path.Combine(workspace.Path, "NuGet.Config");
421workspace.Path);
426var results = client.FilterPackageSearchResults(resolvedPackages, configPath, workspace.Path);
445var configPath = Path.Combine(workspace.Path, "NuGet.Config");
459configPath, workspace.Path));
NuGet\NuGetConfigurationQueryTests.cs (9)
25var configPath = Path.Combine(workspace.Path, "nuget.config");
55new TestConfigurationService { SettingsFilePath = Path.Combine(workspace.Path, "global.json") });
83var configPath = Path.Combine(workspace.Path, "nuget.config");
116new TestConfigurationService { SettingsFilePath = Path.Combine(workspace.Path, "global.json") });
172await File.WriteAllTextAsync(Path.Combine(workspace.Path, "nuget.config"), $$"""
188Assert.True(Assert.Single(service.GetNuGetSettings(workspace.Path, TestContext.Current.CancellationToken).Sources,
201Assert.True(Assert.Single(service.GetNuGetSettings(workspace.Path, TestContext.Current.CancellationToken).Sources,
213NuGetTestHelper.GetEligiblePackageSources(workspace.Path, "Aspire.Hosting.AppHost"));
215NuGetTestHelper.GetEligiblePackageSources(workspace.Path, packageId));
Packaging\IntegrationSourceTests.cs (14)
72var global = new FileInfo(Path.Combine(workspace.Path, "global.json"));
79File.WriteAllText(Path.Combine(workspace.Path, AspireConfigFile.FileName), """
105var global = new FileInfo(Path.Combine(workspace.Path, "global.json"));
106File.WriteAllText(Path.Combine(workspace.Path, AspireConfigFile.FileName), """
121File.WriteAllText(Path.Combine(workspace.Path, AspireConfigFile.FileName), json);
124workspace.WorkspaceRoot, new FileInfo(Path.Combine(workspace.Path, "global.json"))));
185var global = new FileInfo(Path.Combine(workspace.Path, "global.json"));
189File.WriteAllText(Path.Combine(workspace.Path, AspireConfigFile.FileName), """
215File.WriteAllText(Path.Combine(workspace.Path, AspireConfigFile.FileName), """
265File.WriteAllText(Path.Combine(workspace.Path, AspireConfigFile.FileName), """
349File.WriteAllText(Path.Combine(workspace.Path, AspireConfigFile.FileName), """
400File.WriteAllText(Path.Combine(workspace.Path, AspireConfigFile.FileName), """
429File.WriteAllText(Path.Combine(workspace.Path, AspireConfigFile.FileName), """{"integrationSources":"invalid"}""");
463File.WriteAllText(Path.Combine(workspace.Path, AspireConfigFile.FileName), """
ProgramTests.cs (4)
65File.WriteAllText(Path.Combine(workspace.Path, InstallSidecarReader.SidecarFileName), $$"""{"source":"{{source}}"}""");
72? Path.Combine(workspace.Path, "mise", "installs", "aspire", "13.5.0", "aspire")
73: Path.Combine(workspace.Path, "aspire");
104new TestProcessPathProvider(Path.Combine(workspace.Path, "aspire.exe")),
Projects\JavaAppHostToolchainResolverTests.cs (58)
85File.WriteAllText(Path.Combine(workspace.Path, "pom.xml"), "<project />");
96File.WriteAllText(Path.Combine(workspace.Path, buildFileName), "");
105File.WriteAllText(Path.Combine(workspace.Path, "pom.xml"), "<project />");
106File.WriteAllText(Path.Combine(workspace.Path, "build.gradle"), "");
115File.WriteAllText(Path.Combine(workspace.Path, "pom.xml"), "<project />");
139File.WriteAllText(Path.Combine(workspace.Path, "pom.xml"), "<project />");
140var wrapper = WriteWrapper(workspace.Path, OperatingSystem.IsWindows() ? "mvnw.cmd" : "mvnw");
148workspace.Path,
187File.WriteAllText(Path.Combine(workspace.Path, buildFileName), "");
188WriteWrapper(workspace.Path, buildFileName == "pom.xml"
244File.WriteAllText(Path.Combine(workspace.Path, "build.gradle"), "");
245var wrapper = WriteWrapper(workspace.Path, OperatingSystem.IsWindows() ? "gradlew.bat" : "gradlew");
252workspace.Path,
282File.WriteAllText(Path.Combine(workspace.Path, "pom.xml"), "<project />");
283WriteWrapper(workspace.Path, OperatingSystem.IsWindows() ? "mvnw.cmd" : "mvnw");
316var wrapperPath = Path.Combine(workspace.Path, expectedWrapper);
351WriteBuildRootMarker(workspace.Path, useMaven);
353var rootWrapperPath = Path.Combine(workspace.Path, expectedWrapper);
356var moduleDirectory = Directory.CreateDirectory(Path.Combine(workspace.Path, "apphost"));
376var appHostDirectory = CreateMavenReactor(workspace.Path);
377var localRepository = Directory.CreateDirectory(Path.Combine(workspace.Path, "empty-maven-repository"));
387Path.Combine(workspace.Path, OperatingSystem.IsWindows() ? "mvnw.cmd" : "mvnw"),
411Path.Combine(workspace.Path, OperatingSystem.IsWindows() ? "mvnw.cmd" : "mvnw"),
442var appHostDirectory = CreateIndependentMavenReactor(workspace.Path);
443var localRepository = Directory.CreateDirectory(Path.Combine(workspace.Path, "empty-maven-repository"));
453Path.Combine(workspace.Path, OperatingSystem.IsWindows() ? "mvnw.cmd" : "mvnw"),
481Path.Combine(workspace.Path, "pom.xml"),
483var wrapperPath = WriteWrapper(workspace.Path, OperatingSystem.IsWindows() ? "mvnw.cmd" : "mvnw");
485var appHostDirectory = Directory.CreateDirectory(Path.Combine(workspace.Path, "standalone"));
693WriteBuildRootMarker(workspace.Path, useMaven);
694File.WriteAllText(Path.Combine(workspace.Path, OperatingSystem.IsWindows() ? windowsWrapperName : wrapperName), "");
696var innerCheckout = Directory.CreateDirectory(Path.Combine(workspace.Path, "inner"));
722File.WriteAllText(Path.Combine(workspace.Path, "build.gradle"), "");
723WriteWrapper(workspace.Path, OperatingSystem.IsWindows() ? "gradlew.bat" : "gradlew");
724var scriptPath = Path.Combine(workspace.Path, ".aspire", "aspire-gradle-init.gradle");
741File.WriteAllText(Path.Combine(workspace.Path, "build.gradle"), "");
742WriteWrapper(workspace.Path, OperatingSystem.IsWindows() ? "gradlew.bat" : "gradlew");
746var script = await File.ReadAllTextAsync(Path.Combine(workspace.Path, ".aspire", "aspire-gradle-init.gradle"));
757File.WriteAllText(Path.Combine(workspace.Path, "pom.xml"), "<project />");
759var dependencyDirectory = Path.Combine(workspace.Path, "target", "aspire-deps");
774File.WriteAllText(Path.Combine(workspace.Path, "pom.xml"), "<project />");
778Assert.False(Directory.Exists(Path.Combine(workspace.Path, "target")));
785File.WriteAllText(Path.Combine(workspace.Path, "build.gradle"), "");
786WriteWrapper(workspace.Path, OperatingSystem.IsWindows() ? "gradlew.bat" : "gradlew");
788var dependencyDirectory = Path.Combine(workspace.Path, "build", "aspire-deps");
807File.WriteAllText(Path.Combine(workspace.Path, "pom.xml"), "<project />");
824File.WriteAllText(Path.Combine(workspace.Path, buildFileName), "");
825var appHostDirectory = Directory.CreateDirectory(Path.Combine(workspace.Path, "src", "main", "java"));
832Assert.Equal(workspace.Path, resolution.ProjectDirectory.FullName);
839File.WriteAllText(Path.Combine(workspace.Path, "pom.xml"), "<project />");
840var appHostDirectory = Directory.CreateDirectory(Path.Combine(workspace.Path, "a", "b", "c"));
849File.WriteAllText(Path.Combine(workspace.Path, "pom.xml"), "<project />");
850WriteWrapper(workspace.Path, OperatingSystem.IsWindows() ? "mvnw.cmd" : "mvnw");
851var appHostDirectory = Directory.CreateDirectory(Path.Combine(workspace.Path, "src", "main", "java"));
891File.WriteAllText(Path.Combine(workspace.Path, "build.gradle"), "");
892WriteWrapper(workspace.Path, OperatingSystem.IsWindows() ? "gradlew.bat" : "gradlew");
893var appHostDirectory = Directory.CreateDirectory(Path.Combine(workspace.Path, "src", "main", "java"));
900var scriptPath = Path.Combine(workspace.Path, ".aspire", "aspire-gradle-init.gradle");
Projects\NativeAppHostServerProjectTests.cs (44)
27var enabled = Directory.CreateDirectory(Path.Combine(workspace.Path, "enabled"));
29var disabled = Directory.CreateDirectory(Path.Combine(workspace.Path, "disabled"));
30var executable = Path.Combine(workspace.Path, "server");
39Layout = new LayoutConfiguration { LayoutPath = workspace.Path }
59new AspireConfigFile { Features = new() { [KnownFeatures.AppHostServerV2] = true } }.Save(workspace.Path);
62Assert.Equal(workspace.Path, factory.GetInstanceIdentifier(workspace.Path));
63var exception = await Assert.ThrowsAsync<InvalidOperationException>(() => factory.CreateAsync(workspace.Path));
71new AspireConfigFile { Features = new() { [KnownFeatures.AppHostServerV2] = true } }.Save(workspace.Path);
86var layout = new LayoutConfiguration { LayoutPath = workspace.Path };
106using var project = Assert.IsType<NativeAppHostServerProject>(await factory.CreateAsync(workspace.Path));
118Assert.Throws<ArgumentException>(() => new NativeAppHostServerProject(workspace.Path,
119Path.Combine(workspace.Path, "missing"), new TestProcessExecutionFactory(), NullLogger.Instance));
126var executable = Path.Combine(workspace.Path, "server");
128using var project = new NativeAppHostServerProject(workspace.Path, executable, new TestProcessExecutionFactory(), NullLogger.Instance);
138[IntegrationReference.FromProject("Aspire.Hosting.Redis", Path.Combine(workspace.Path, "Redis.csproj"))]));
149var executable = Path.Combine(workspace.Path, "server");
151using var project = new NativeAppHostServerProject(workspace.Path, executable, new TestProcessExecutionFactory(), NullLogger.Instance);
153? IntegrationReference.FromProject(name, Path.Combine(workspace.Path, "tooling.csproj"))
163var executable = Path.Combine(workspace.Path, "server");
171Assert.Equal(workspace.Path, start.WorkingDirectory);
172Assert.Equal(["server", "--contentRoot", workspace.Path], start.ArgumentList);
190using (var project = new NativeAppHostServerProject(workspace.Path, executable, factory, NullLogger.Instance))
218var executable = Path.Combine(workspace.Path, "server");
239using var project = new NativeAppHostServerProject(workspace.Path, executable, processes, NullLogger.Instance);
258var executable = Path.Combine(workspace.Path, "server");
272using var project = new NativeAppHostServerProject(workspace.Path, executable, factory, NullLogger.Instance)
274LayoutLease = new BundleLayoutLease(new LayoutConfiguration { LayoutPath = workspace.Path }, null)
310var executable = Path.Combine(workspace.Path, "server");
316var layout = new LayoutConfiguration { LayoutPath = workspace.Path };
320Assert.Equal(["server", "--contentRoot", workspace.Path], start.ArgumentList);
341using var project = new NativeAppHostServerProject(workspace.Path, executable, factory, NullLogger.Instance)
375var executable = Path.Combine(workspace.Path, "server");
383using var project = new NativeAppHostServerProject(workspace.Path, executable, processes, logger);
434var executable = Path.Combine(workspace.Path, "server");
436var root = Directory.CreateDirectory(Path.Combine(workspace.Path, "provider"));
447await File.WriteAllTextAsync(Path.Combine(workspace.Path, "outside.json"), "{}");
448using var project = new NativeAppHostServerProject(workspace.Path, executable,
461var executable = Path.Combine(workspace.Path, "server");
462var managedDirectory = Directory.CreateDirectory(Path.Combine(workspace.Path, "managed"));
465await File.WriteAllTextAsync(Path.Combine(workspace.Path, "ats-contract.json"), "{}");
466var providerDirectory = Directory.CreateDirectory(Path.Combine(workspace.Path, "provider"));
493using var project = new NativeAppHostServerProject(workspace.Path, executable, processes, logger)
495LayoutLease = new BundleLayoutLease(new LayoutConfiguration { LayoutPath = workspace.Path }, null)
Projects\PrebuiltAppHostServerTests.cs (7)
268new TestConfigurationService { SettingsFilePath = Path.Combine(workspace.Path, "global.json") })
352await File.WriteAllTextAsync(Path.Combine(workspace.Path, AspireConfigFile.FileName), $$"""
377var configPath = Path.Combine(workspace.Path, "NuGet.Config");
390new TestConfigurationService { SettingsFilePath = Path.Combine(workspace.Path, "global.json") })
397var plan = await resolver.ResolveAsync(workspace.Path, "test-apphost", sdkVersion, channelName,
403workspace.Path, sources: restoreConfiguration.Sources,
2399new TestConfigurationService { SettingsFilePath = Path.Combine(workspace.Path, "global.json") })
Projects\ProjectUpdaterNuGetConfigurationTests.cs (39)
55var configFile = new FileInfo(Path.Combine(workspace.Path, "NuGet.Config"));
108Assert.Empty(Directory.EnumerateDirectories(Path.Combine(workspace.Path, ".aspire"), ".aspire-nuget-config-*"));
151Assert.Empty(Directory.EnumerateDirectories(Path.Combine(workspace.Path, ".aspire"), ".aspire-nuget-config-*"));
172var configPath = Path.Combine(workspace.Path, AspireConfigFile.FileName);
214var config = AspireConfigFile.Load(workspace.Path);
249var aspireConfigPath = Path.Combine(workspace.Path, AspireConfigFile.FileName);
342var aspireConfig = AspireConfigFile.Load(workspace.Path);
364Assert.Empty(Directory.EnumerateDirectories(Path.Combine(workspace.Path, ".aspire"), ".aspire-nuget-config-*"));
394Assert.False(File.Exists(Path.Combine(workspace.Path, "nuget.config")));
395Assert.Empty(Directory.EnumerateDirectories(Path.Combine(workspace.Path, ".aspire"), ".aspire-nuget-config-*"));
423var configFile = new FileInfo(Path.Combine(workspace.Path, "NuGet.Config"));
526var configFile = new FileInfo(Path.Combine(workspace.Path, "NuGet.Config"));
534var projectFile = new FileInfo(Path.Combine(workspace.Path, "apphost.cs"));
544var aspireConfigPath = Path.Combine(workspace.Path, AspireConfigFile.FileName);
595Assert.Equal(newVersion, AspireConfigFile.Load(workspace.Path)!.SdkVersion);
626var file = new FileInfo(Path.Combine(workspace.Path, fileName));
656await File.WriteAllTextAsync(Path.Combine(workspace.Path, AspireConfigFile.FileName),
703Assert.Empty(Directory.EnumerateDirectories(Path.Combine(workspace.Path, ".aspire"), ".aspire-nuget-config-*"));
720var channelSourceKey = $"aspire-{AppHostWorkloadId.Create(workspace.Path)}";
738var configFile = new FileInfo(Path.Combine(workspace.Path, "NuGet.Config"));
787NuGetTestHelper.GetEligiblePackageSources(workspace.Path, "Aspire.Hosting.Redis").Order());
789.GetNuGetSettings(workspace.Path, TestContext.Current.CancellationToken);
818var configFile = new FileInfo(Path.Combine(workspace.Path, "NuGet.Config"));
854options.NuGetRestoreTargetsFile?.DirectoryName ?? workspace.Path, "Aspire.Hosting.Redis").Order());
884NuGetTestHelper.GetEligiblePackageSources(workspace.Path, "Aspire.Hosting.Redis").Order());
886.GetNuGetSettings(workspace.Path, TestContext.Current.CancellationToken);
944await File.WriteAllTextAsync(Path.Combine(workspace.Path, AspireConfigFile.FileName),
966var aspireConfigPath = Path.Combine(workspace.Path, AspireConfigFile.FileName);
1036var parentConfig = new FileInfo(Path.Combine(workspace.Path, "NuGet.Config"));
1196var aspireConfigPath = Path.Combine(workspace.Path, AspireConfigFile.FileName);
1331Assert.Empty(Directory.EnumerateFiles(workspace.Path, ".aspire-nuget-candidate-*"));
1332Assert.Empty(Directory.EnumerateDirectories(Path.Combine(workspace.Path, ".aspire"), ".aspire-nuget-config-*"));
1443Assert.Empty(Directory.EnumerateFiles(workspace.Path, ".aspire-nuget-candidate-*"));
1460var propsFile = new FileInfo(Path.Combine(workspace.Path, "Directory.Packages.props"));
1494var configFile = new FileInfo(Path.Combine(workspace.Path, "NuGet.Config"));
1524var configPath = Path.Combine(workspace.Path, "NuGet.Config");
1573var configPath = Path.Combine(workspace.Path, "NuGet.Config");
1609Assert.Equal([privateSource], NuGetTestHelper.GetEligiblePackageSources(workspace.Path, "Aspire.Hosting.Redis"));
1642var parentPath = Path.Combine(workspace.Path, "NuGet.Config");
Telemetry\InternalMicrosoftDetectorTests.cs (68)
43var cacheFilePath = Path.Combine(workspace.Path, "cache", "detector.json");
85var cacheFilePath = Path.Combine(workspace.Path, "cache", "detector.json");
111var cacheFilePath = Path.Combine(workspace.Path, "cache", "detector.json");
135var cacheFilePath = Path.Combine(workspace.Path, "cache", "detector.json");
174Path.Combine(workspace.Path, "cache", "detector.json"),
210Path.Combine(workspace.Path, "cache", "detector.json"),
256Path.Combine(workspace.Path, "cache", "detector.json"),
286Path.Combine(workspace.Path, "cache", "detector.json"),
329Path.Combine(workspace.Path, "cache", "detector.json"),
356Path.Combine(workspace.Path, "cache", "detector.json"),
372var cacheFilePath = Path.Combine(workspace.Path, "cache", "detector.json");
391var cacheFilePath = Path.Combine(workspace.Path, "cache", "detector.json");
418var cacheFilePath = Path.Combine(workspace.Path, "cache", "detector.json");
441var cacheFilePath = Path.Combine(workspace.Path, "cache", "detector.json");
467Path.Combine(workspace.Path, "cache", "detector.json"),
490var cacheFilePath = Path.Combine(workspace.Path, "cache", "detector.json");
524var cacheFilePath = Path.Combine(workspace.Path, "cache", "detector.json");
563var cacheFilePath = Path.Combine(workspace.Path, "cache", "detector.json");
589Path.Combine(workspace.Path, "cache", "detector.json"),
610Path.Combine(workspace.Path, "cache", "detector.json"),
630await File.WriteAllTextAsync(Path.Combine(workspace.Path, "dsregcmd"), string.Empty);
631await File.WriteAllTextAsync(Path.Combine(workspace.Path, "dsregcmd.EXE"), string.Empty);
642Path.Combine(workspace.Path, "cache", "detector.json"),
648["PATH"] = workspace.Path,
668await File.WriteAllTextAsync(Path.Combine(workspace.Path, "dsregcmd"), string.Empty);
669await File.WriteAllTextAsync(Path.Combine(workspace.Path, "dsregcmd.EXE"), string.Empty);
679Path.Combine(workspace.Path, "cache", "detector.json"),
685["PATH"] = workspace.Path,
702await File.WriteAllTextAsync(Path.Combine(workspace.Path, "dsregcmd"), string.Empty);
703await File.WriteAllTextAsync(Path.Combine(workspace.Path, "dsregcmd.EXE"), string.Empty);
710Path.Combine(workspace.Path, "cache", "detector.json"),
716["PATH"] = workspace.Path,
849var appSsoPath = Path.Combine(workspace.Path, "usr", "bin", "app-sso");
871Path.Combine(workspace.Path, "cache", "detector.json"),
891var outputPath = Path.Combine(workspace.Path, "platform-sso-output.txt");
922Path.Combine(workspace.Path, "detector.json"),
941Path.Combine(workspace.Path, "cache", "detector.json"),
944macPlatformSsoPath: Path.Combine(workspace.Path, "missing-app-sso"));
957var appSsoPath = Path.Combine(workspace.Path, "app-sso");
987Path.Combine(workspace.Path, "cache", "detector.json"),
1001Path.Combine(workspace.Path, "full-detector-cache", "detector.json"),
1074Path.Combine(workspace.Path, "cache", "detector.json"),
1095await File.WriteAllTextAsync(Path.Combine(workspace.Path, "dsregcmd"), string.Empty);
1096await File.WriteAllTextAsync(Path.Combine(workspace.Path, "dsregcmd.EXE"), string.Empty);
1102Path.Combine(workspace.Path, "cache", "detector.json"),
1108["PATH"] = workspace.Path,
1126await File.WriteAllTextAsync(Path.Combine(workspace.Path, executable), string.Empty);
1133["PATH"] = workspace.Path
1136Path.Combine(workspace.Path, "cache", "detector.json"),
1157await File.WriteAllTextAsync(Path.Combine(workspace.Path, executable), string.Empty);
1164["PATH"] = workspace.Path
1167Path.Combine(workspace.Path, "cache", "detector.json"),
1191Path.Combine(workspace.Path, "cache", "detector.json"),
1216Path.Combine(workspace.Path, "cache", "detector.json"),
1233var cacheFilePath = Path.Combine(workspace.Path, "cache", "detector.json");
1264Path.Combine(workspace.Path, "cache", "detector.json"),
1288Path.Combine(workspace.Path, "cache", "detector.json"),
1312Path.Combine(workspace.Path, "cache", "detector.json"),
1336Path.Combine(workspace.Path, "cache", "detector.json"),
1359Path.Combine(workspace.Path, "cache", "detector.json"),
1364["PATH"] = workspace.Path,
1388environmentVariables["PATH"] = workspace.Path;
1391Path.Combine(workspace.Path, "cache", "detector.json"),
1416Path.Combine(workspace.Path, "cache", "detector.json"),
1622environmentVariables["PATH"] = workspace.Path;
1625Path.Combine(workspace.Path, "cache", "detector.json"),
1672environmentVariables["PATH"] = workspace.Path;
1675Path.Combine(workspace.Path, "cache", "detector.json"),
Utils\TemporaryWorkspaceTests.cs (9)
23Assert.True(Directory.Exists(Path.Combine(workspace.Path, ".git")));
24Assert.Contains(recordingOutput.Messages, message => message.EndsWith($"Starting 'git init' in '{workspace.Path}'", StringComparison.Ordinal));
46await TemporaryWorkspaceGitExtensions.RunGitAsync(workspace.Path, recordingOutput, ["-c", $"alias.noisy={alias}", "noisy"], TestContext.Current.CancellationToken);
62TemporaryWorkspaceGitExtensions.RunGitAsync(workspace.Path, recordingOutput, ["-c", $"alias.fail={alias}", "fail"], TestContext.Current.CancellationToken));
64Assert.Equal($"'git -c alias.fail={alias} fail' in '{workspace.Path}' failed with exit code 7. stdout: test-stdout{Environment.NewLine}, stderr: test-stderr{Environment.NewLine}", exception.Message);
89TemporaryWorkspaceGitExtensions.RunGitAsync(workspace.Path, recordingOutput, ["-c", $"alias.wait={alias}", "wait"], cancellation.Token));
114: GitTestHelper.RunGitAsync(workspace.Path, recordingOutput, "--version"));
149TemporaryWorkspaceGitExtensions.RunGitAsync(workspace.Path, recordingOutput, ["-c", "alias.wait=!echo ready; echo ready >&2; sleep 60", "wait"], TestContext.Current.CancellationToken));
185TemporaryWorkspaceGitExtensions.RunGitAsync(workspace.Path, recordingOutput,