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 (4)
33var before = Directory.GetFileSystemEntries(_context.Workspace.Path, "*", SearchOption.AllDirectories).Order().ToArray();
40Assert.Equal(before, Directory.GetFileSystemEntries(_context.Workspace.Path, "*", SearchOption.AllDirectories).Order());
61Path.Combine(_context.Workspace.Path, directory, skills, "aspire", "SKILL.md"), "outside the workspace");
115await 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 (42)
54Assert.False(File.Exists(Path.Combine(workspace.Path, AspireConfigFile.FileName)));
77var config = AspireConfigFile.Load(Path.Combine(workspace.Path, outputDirectory));
99var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
145Repository = Path.Combine(workspace.Path, "missing-repository"),
202Repository = Path.Combine(workspace.Path, "missing-repository"),
295var projectFile = new FileInfo(Path.Combine(workspace.Path, "apphost.cs"));
386await File.WriteAllTextAsync(Path.Combine(workspace.Path, "Test.sln"), "Fake solution file");
434Assert.False(File.Exists(Path.Combine(workspace.Path, AspireConfigFile.FileName)));
435var appHostConfigPath = Path.Combine(workspace.Path, "Test.AppHost", AspireConfigFile.FileName);
443$"agent init --workspace-root \"{workspace.Path}\" --agents {agent} --scope project --skills aspire --non-interactive");
450Assert.False(File.Exists(Path.Combine(workspace.Path, AspireConfigFile.FileName)));
560var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
598var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
612var projectFile = new FileInfo(Path.Combine(workspace.Path, "apphost.cs"));
693var rootPath = Path.Combine(workspace.Path, AspireConfigFile.FileName);
716Assert.Equal("version-2", AspireConfigFile.Load(workspace.Path)!.ConfigSource!.AppliedVersion);
744var localPath = Path.Combine(workspace.Path, AspireConfigFile.FileName);
759$"update --config-source --apphost \"{Path.Combine(workspace.Path, requestedPath)}\" --yes --non-interactive");
780var parentPath = Path.Combine(workspace.Path, AspireConfigFile.FileName);
828var localPath = Path.Combine(workspace.Path, AspireConfigFile.FileName);
832await File.WriteAllTextAsync(Path.Combine(workspace.Path, "apphost.cs"), "#:sdk Aspire.AppHost.Sdk");
846var appHostArgument = explicitAppHost ? $" --apphost \"{Path.Combine(workspace.Path, "apphost.cs")}\"" : "";
873var configPath = Path.Combine(workspace.Path, AspireConfigFile.FileName);
936Assert.Equivalent(expectedSource, AspireConfigFile.Load(workspace.Path)!.ConfigSource, strict: true);
1003var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
1006await File.WriteAllTextAsync(Path.Combine(workspace.Path, "AppHost.csproj"), "<Project />");
1076Assert.Equal(bound || childConfigExists ? s_source.AppliedVersion : "version-1", AspireConfigFile.Load(workspace.Path)!.ConfigSource!.AppliedVersion);
1093var parentPath = Path.Combine(workspace.Path, AspireConfigFile.FileName);
1131Path.Combine(workspace.Path, AspireConfigFile.FileName), "appHost.path", "selected/apphost.cs");
1158var parentPath = Path.Combine(workspace.Path, AspireConfigFile.FileName);
1227var missingProject = Path.Combine(workspace.Path, "missing.csproj");
1280var output = Path.Combine(workspace.Path, "created-project");
1287await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", AspireConfigFile.FileName), "{}");
1304Assert.False(File.Exists(Path.Combine(workspace.Path, AspireConfigFile.FileName)));
1321Assert.Equivalent(accepted ? s_source : new ConfigSource { OptOut = true }, AspireConfigFile.Load(workspace.Path)!.ConfigSource, strict: true);
1322var configuration = JsonNode.Parse(await File.ReadAllTextAsync(Path.Combine(workspace.Path, AspireConfigFile.FileName)))!;
1324Assert.True(File.Exists(Path.Combine(workspace.Path, "apphost.cs")));
1337var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
1366await File.WriteAllTextAsync(Path.Combine(workspace.Path, "Test.sln"), "Fake solution file");
1367var childPath = Path.Combine(workspace.Path, "Test.AppHost");
1369var rootConfigPath = Path.Combine(workspace.Path, AspireConfigFile.FileName);
1519var 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)));
585await File.WriteAllTextAsync(Path.Combine(workspace.Path, "apphost.mts"), "console.log('existing AppHost');");
588var originalFiles = Directory.GetFiles(workspace.Path, "*", SearchOption.AllDirectories)
631var projectFiles = Directory.GetFiles(workspace.Path, "*", SearchOption.AllDirectories).Where(path => path != logFilePath);
835File.WriteAllText(Path.Combine(workspace.Path, "go.mod"), moduleContent);
836File.WriteAllText(Path.Combine(workspace.Path, "go.work"), workspaceContent);
837File.WriteAllText(Path.Combine(workspace.Path, "main.go"), sourceContent);
866Assert.Equal(moduleContent, File.ReadAllText(Path.Combine(workspace.Path, "go.mod")));
867Assert.Equal(workspaceContent, File.ReadAllText(Path.Combine(workspace.Path, "go.work")));
868Assert.Equal(sourceContent, File.ReadAllText(Path.Combine(workspace.Path, "main.go")));
869Assert.Equal("module apphost\n\ngo 1.26\n", File.ReadAllText(Path.Combine(workspace.Path, "aspire-apphost", "go.mod")));
872File.ReadAllText(Path.Combine(workspace.Path, "aspire-apphost", "go.work")));
873var 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 (26)
45await WriteConfiguredSourcesAsync(provider, new() { ["company"] = Path.Combine(workspace.Path, "template") });
51Assert.Equal("Found: Hello", await File.ReadAllTextAsync(Path.Combine(workspace.Path, "out", "Demo.txt")));
168"working": { "path": {{JsonSerializer.Serialize(workspace.Path)}} },
208await WriteConfiguredSourcesAsync(provider, new() { [sourceName] = workspace.Path });
221await WriteConfiguredSourcesAsync(provider, new() { ["company"] = workspace.Path });
222await File.WriteAllTextAsync(Path.Combine(workspace.Path, "aspire.config.json"),
228Assert.Equal(workspace.Path, source.Value.Template?.Path);
246["first-source"] = Path.Combine(workspace.Path, "first"),
247["second-source"] = Path.Combine(workspace.Path, "second")
268await WriteConfiguredSourcesAsync(provider, new() { ["examples"] = Path.Combine(workspace.Path, "template") });
293["missing"] = Path.Combine(workspace.Path, "missing"),
295["working"] = Path.Combine(workspace.Path, "valid")
327await WriteConfiguredSourcesAsync(provider, new() { ["company"] = workspace.Path });
366["second-source"] = new { path = Path.Combine(workspace.Path, "second"), displayName = "Company [templates]" },
367["first-source"] = new { path = Path.Combine(workspace.Path, "first"), displayName = "Company [templates]" }
407var templatePath = Path.Combine(workspace.Path, "template");
439await WriteConfiguredSourcesAsync(provider, new() { ["company"] = Path.Combine(workspace.Path, "template") });
477await WriteConfiguredSourcesAsync(provider, new() { ["missing"] = Path.Combine(workspace.Path, "missing") });
490Assert.False(Directory.Exists(Path.Combine(workspace.Path, "out")));
588.Parse(["config", "set", "templateSources.company.path", workspace.Path, "--global"])
594Assert.Equal(workspace.Path, source.Value.Template?.Path);
632Assert.False(Directory.Exists(Path.Combine(workspace.Path, "out")));
642await WriteConfiguredSourcesAsync(provider, new() { ["company"] = workspace.Path });
672await WriteConfiguredSourcesAsync(provider, new() { ["company"] = Path.Combine(workspace.Path, "templates") });
688await WriteConfiguredSourcesAsync(provider, new() { ["company"] = Path.Combine(workspace.Path, "template") });
730await File.WriteAllTextAsync(Path.Combine(workspace.Path, directory, "TemplateApp.txt"), $"{marker}: GreetingValue");
Commands\NewCommandLocalTemplateTests.cs (71)
49await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", "greeting.txt"), "GreetingValue");
103await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", "features.txt"), "FeaturesValue");
210Assert.Equal(ReadOutput(Path.Combine(workspace.Path, "non-interactive-out")), ReadOutput(workspace));
272await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", "settings.txt"), "Mode: [ModeValue]\n");
378Assert.Equal(!useDatabase, Directory.Exists(Path.Combine(workspace.Path, "out")));
414await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", "settings.txt"),
460await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", "settings.txt"),
495Assert.False(Directory.Exists(Path.Combine(workspace.Path, "out")));
521await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", "settings.txt"), "First: FirstValue\nSecond: SecondValue\n");
548await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", ".git"), "gitdir: ../git-storage");
556await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", ".gitignore"), "bin/");
557await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", ".gitattributes"), "* text=auto");
560var originalSource = ReadOutput(Path.Combine(workspace.Path, "template"));
570Assert.Equal(originalSource, ReadOutput(Path.Combine(workspace.Path, "template")));
582var templatePath = Path.Combine(workspace.Path, templateDirectory);
678outputCreated = File.Exists(Path.Combine(workspace.Path, "out", "Demo.cs"));
722await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", "aspire.config.json"), """
743using var generatedConfig = JsonDocument.Parse(await File.ReadAllTextAsync(Path.Combine(workspace.Path, "out", "aspire.config.json")));
822var outputPath = Path.Combine(workspace.Path, "out");
837.AddScrubber(builder => builder.Replace('\\', '/').Replace(workspace.Path.Replace('\\', '/'), "{workspace}"))
867var outputPath = Path.Combine(workspace.Path, "out");
872.AddScrubber(builder => builder.Replace('\\', '/').Replace(workspace.Path.Replace('\\', '/'), "{workspace}"))
886var templateConfigPath = Path.Combine(workspace.Path, "template", "nuget.config");
887var targetConfigPath = Path.Combine(workspace.Path, "template", fileName);
953var outputPath = Path.Combine(workspace.Path, "out");
968.AddScrubber(builder => builder.Replace('\\', '/').Replace(workspace.Path.Replace('\\', '/'), "{workspace}"))
980var sourceConfigPath = Path.Combine(workspace.Path, "template", "nuget.config");
991foreach (var file in Directory.EnumerateFiles(Path.Combine(workspace.Path, "template"), "*", SearchOption.AllDirectories))
993var target = Path.Combine(destination.FullName, Path.GetRelativePath(Path.Combine(workspace.Path, "template"), file));
1012Assert.Equal(ownedConfig, await File.ReadAllTextAsync(Path.Combine(workspace.Path, "out", "nuget.config")));
1017ReadOutput(Path.Combine(workspace.Path, "template")).Keys);
1020var cachedTemplate = Assert.Single(Directory.GetDirectories(Path.Combine(workspace.Path, ".aspire", "cache", "git")));
1022ReadOutput(Path.Combine(workspace.Path, "template")),
1045Assert.False(Directory.Exists(Path.Combine(workspace.Path, "out")));
1087Assert.False(File.Exists(Path.Combine(workspace.Path, "out", "nuget.config")));
1097Assert.Equal("Template content", await File.ReadAllTextAsync(Path.Combine(workspace.Path, "out", "nuget.config", "keep.txt")));
1125var config = XDocument.Load(Path.Combine(workspace.Path, "out", "nuget.config"));
1141await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", ".template.config", "aspirecli.host.json"), "{}");
1152Assert.False(Directory.Exists(Path.Combine(workspace.Path, "out")));
1199Assert.False(Directory.Exists(Path.Combine(workspace.Path, "out")));
1218await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", ".template.config", "template.json"), "{ not json");
1222await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template"), "not a directory");
1232Assert.False(Directory.Exists(Path.Combine(workspace.Path, "out")));
1259await File.WriteAllTextAsync(Path.Combine(workspace.Path, "out", "existing.txt"), "Keep me");
1298Assert.Equal("second", await File.ReadAllTextAsync(Path.Combine(workspace.Path, "out", "identity.txt")));
1304Assert.False(Directory.Exists(Path.Combine(workspace.Path, "out")));
1337Assert.False(Directory.Exists(Path.Combine(workspace.Path, "out")));
1355Assert.False(Directory.Exists(Path.Combine(workspace.Path, "out")));
1372["new", "--template-path", Path.Combine(workspace.Path, "template"), "--name", "Demo", "--output", "out", "--suppress-agent-init"])
1414var outputDirectory = Path.Combine(workspace.Path, "out");
1498await CreateTemplateAsync(workspace, Path.GetRelativePath(workspace.Path, Path.Combine(destination.FullName, "template")));
1568Assert.False(Directory.Exists(Path.Combine(workspace.Path, "out")));
1590templatePath == "absolute" ? workspace.Path : templatePath,
1596Assert.False(Directory.Exists(Path.Combine(workspace.Path, "out")));
1606var linkPath = Path.Combine(workspace.Path, "template-link");
1609Directory.CreateSymbolicLink(linkPath, workspace.Path);
1635Assert.False(Directory.Exists(Path.Combine(workspace.Path, "out")));
1639Assert.True(Directory.Exists(workspace.Path));
1666Assert.False(Directory.Exists(Path.Combine(workspace.Path, "out")));
1687await CreateTemplateAsync(workspace, Path.GetRelativePath(workspace.Path, Path.Combine(destination.FullName, "template")));
1807outputs[label] = ReadOutput(Path.Combine(workspace.Path, "out", label));
1819await CreateTemplateAsync(workspace, Path.GetRelativePath(workspace.Path, Path.Combine(destination.FullName, "one")));
1820await CreateTemplateAsync(workspace, Path.GetRelativePath(workspace.Path, Path.Combine(destination.FullName, "two")));
1877await CreateTemplateAsync(workspace, Path.GetRelativePath(workspace.Path, Path.Combine(destination.FullName, "template")));
2069await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", "nuget.config"), """
2081await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", "aspire.config.json"), """
2114await File.WriteAllTextAsync(Path.Combine(workspace.Path, "nuget.config"), """
2140await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", "aspire.config.json"),
2145ReadOutput(Path.Combine(workspace.Path, "out"));
2177await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", "settings.txt"), "Mode: [ModeValue]\n");
2217await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", "settings.txt"),
Commands\NewCommandLocalTemplateTests.HostConfiguration.cs (20)
37var config = Path.Combine(workspace.Path, "template", ".template.config");
95await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", ".template.config", "aspirecli.host.json"), """
161await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", "settings.json"),
175using var settings = JsonDocument.Parse(await File.ReadAllTextAsync(Path.Combine(workspace.Path, "out", "settings.json")));
191await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", ".template.config", "aspirecli.host.json"), """
207Assert.False(Directory.Exists(Path.Combine(workspace.Path, "out")));
227var config = Path.Combine(workspace.Path, "template", ".template.config");
239Assert.False(Directory.Exists(Path.Combine(workspace.Path, "out")));
247await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", ".template.config", "aspirecli.host.json"), """
270await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", ".template.config", "aspirecli.host.json"), """
301var hostFile = Path.Combine(workspace.Path, "template", ".template.config", "aspirecli.host.json");
311await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", "aspire.config.json"), """
318await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", "apphost.mts"),
345var config = Path.Combine(workspace.Path, "template", ".template.config");
353await File.WriteAllTextAsync(Path.Combine(workspace.Path, "template", "aspire.config.json"), "{}");
376var output = Path.Combine(workspace.Path, "out");
432var output = Path.Combine(workspace.Path, "out");
497var appHost = XDocument.Load(Path.Combine(workspace.Path, "out", "Demo.AppHost", "Demo.AppHost.csproj"));
526var result = await creator.InstantiateAsync(discoveredTemplate, "Demo", null, Path.Combine(workspace.Path, "out"),
532var invalid = await creator.InstantiateAsync(discoveredTemplate, "Demo", null, Path.Combine(workspace.Path, "invalid"),
Commands\NewCommandLocalTemplateTests.InitConfig.cs (17)
51"enterprise": { "path": {{JsonSerializer.Serialize(Path.Combine(workspace.Path, "enterprise"))}} }
61await WriteConfiguredSourcesAsync(provider, new() { ["personal"] = Path.Combine(workspace.Path, "personal") });
74await File.ReadAllTextAsync(Path.Combine(workspace.Path, "out", "Demo.txt")));
105await WriteConfiguredSourcesAsync(provider, new() { ["personal"] = workspace.Path });
136var localPath = Path.Combine(workspace.Path, AspireConfigFile.FileName);
137await WriteConfiguredSourcesAsync(provider, new() { ["Enterprise"] = workspace.Path });
151Assert.Equal(new TemplateSource(workspace.Path, null, null), sources.Single(source => source.Key == "Enterprise").Value.Template);
161await store.AddAsync("SHARED", new JsonObject { ["path"] = workspace.Path, ["displayName"] = "Personal templates" }, default);
162Assert.Equal(new TemplateSource(workspace.Path, null, null),
198"templateSources": { "enterprise": { "path": {{JsonSerializer.Serialize(Path.Combine(workspace.Path, "enterprise"))}}, "displayName": "Team [templates]" } },
207["personal"] = new { path = Path.Combine(workspace.Path, "personal"), displayName = "Team [templates]" }
225var projectConfig = Path.Combine(workspace.Path, "out", AspireConfigFile.FileName);
227Assert.Equal("Enterprise: Hello", await File.ReadAllTextAsync(Path.Combine(workspace.Path, "out", "Demo.txt")));
259await WriteConfiguredSourcesAsync(provider, new() { ["personal"] = Path.Combine(workspace.Path, "personal") });
273await Verify(await File.ReadAllTextAsync(Path.Combine(workspace.Path, "out", AspireConfigFile.FileName)), "json");
274Assert.Equal("Personal: Hello", await File.ReadAllTextAsync(Path.Combine(workspace.Path, "out", "Demo.txt")));
281var 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)
95var projectPath = Path.Combine(workspace.Path, AspireConfigFile.FileName);
101RunStartup(home.FullName, workspace.Path, arguments);
121var projectPath = Path.Combine(workspace.Path, AspireConfigFile.FileName);
127RunStartup(home.FullName, workspace.Path, arguments, exitCode);
145var projectPath = Path.Combine(workspace.Path, AspireConfigFile.FileName);
161RunStartup(home.FullName, workspace.Path, arguments, CliExitCodes.Success);
175File.WriteAllText(Path.Combine(workspace.Path, AspireConfigFile.FileName),
178RunStartup(home.FullName, workspace.Path,
183RunStartup(home.FullName, workspace.Path, "config info", CliExitCodes.Success);
184RunStartup(home.FullName, workspace.Path,
204File.WriteAllText(Path.Combine(workspace.Path, AspireConfigFile.FileName),
209RunStartup(home.FullName, workspace.Path, "template source list", CliExitCodes.InvalidCommand);
227options.StartInfo.WorkingDirectory = workspace.Path;
278options.StartInfo.WorkingDirectory = workspace.Path;
330File.WriteAllText(Path.Combine(workspace.Path, AspireConfigFile.FileName),
333RunStartup(home.FullName, workspace.Path, $"config set {key} {value} --global", CliExitCodes.Success);
339RunStartup(home.FullName, workspace.Path, "new --help", CliExitCodes.Success);
353File.WriteAllText(Path.Combine(workspace.Path, AspireConfigFile.FileName),
356RunStartup(home.FullName, workspace.Path, "config delete features.defaultWatchEnabled --global", CliExitCodes.Success);
372RunStartup(home.FullName, workspace.Path, "config set appHost.path apphost.cs", CliExitCodes.Success);
374var migrated = AspireConfigFile.Load(workspace.Path);
390File.WriteAllText(Path.Combine(workspace.Path, AspireConfigFile.FileName),
393RunStartup(home.FullName, workspace.Path, "--version", CliExitCodes.Success);
398RunStartup(home.FullName, workspace.Path, "config set channel stable --global", CliExitCodes.Success);
399RunStartup(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);
2321Path.Combine(workspace.Path, AspireConfigFile.FileName), """{ "channel": "staging" }""");
2780Path.Combine(workspace.Path, AspireConfigFile.FileName),
2961Path.Combine(workspace.Path, AspireConfigFile.FileName),
3034? Path.Combine(workspace.Path, AspireConfigFile.FileName)
3035: Path.Combine(workspace.Path, ".aspire", "settings.global.json");
3094"parent" => Path.Combine(workspace.Path, AspireConfigFile.FileName),
3095"legacy" => Path.Combine(workspace.Path, ".aspire", "settings.json"),
3096_ => Path.Combine(workspace.Path, ".aspire", "settings.global.json")
3102Path.Combine(workspace.Path, ".aspire", "settings.global.json"), """{ "channel": "daily" }""");
3131await File.WriteAllTextAsync(Path.Combine(workspace.Path, AspireConfigFile.FileName),
3153Path.Combine(workspace.Path, AspireConfigFile.FileName), """{ "channel": "unknown-channel" }""");
Configuration\ConfigSourceServiceGitTests.cs (53)
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.CommitAsync(workspace.Path, outputHelper, "-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.CommitAsync(workspace.Path, outputHelper, "-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.CommitAsync(workspace.Path, outputHelper, "-m", "Unrelated commit");
583await File.WriteAllTextAsync(Path.Combine(workspace.Path, AspireConfigFile.FileName), "invalid JSON is not read during a version check");
584await GitTestHelper.CommitAsync(workspace.Path, outputHelper, "-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.CommitAsync(workspace.Path, outputHelper, "-m", "Add symlink configuration");
636var source = new ConfigSource { Repository = workspace.Path, Path = AspireConfigFile.FileName };
664var (originalCommit, originalVersion) = await ReadConfigRevisionAsync(workspace.Path);
667Repository = workspace.Path,
671"branch" => (await RunGitOutputAsync(workspace.Path, ["branch", "--show-current"])).Trim(),
698await File.WriteAllTextAsync(Path.Combine(workspace.Path, AspireConfigFile.FileName), """{"custom":"updated"}""", token);
699await GitTestHelper.CommitAsync(workspace.Path, outputHelper, "-am", "Update configuration");
702: await ReadConfigRevisionAsync(workspace.Path);
722await GitTestHelper.RunGitAsync(workspace.Path, outputHelper, "init", $"--object-format={objectFormat}");
723var configPath = Path.Combine(workspace.Path, path.Replace('/', Path.DirectorySeparatorChar));
726await GitTestHelper.RunGitAsync(workspace.Path, outputHelper, "add", "--", path);
727await GitTestHelper.CommitAsync(workspace.Path, outputHelper, "-m", "Add configuration");
Configuration\ConfigSourceServiceTests.cs (40)
89Assert.False(File.Exists(Path.Combine(workspace.Path, AspireConfigFile.FileName)));
169Assert.False(File.Exists(Path.Combine(workspace.Path, AspireConfigFile.FileName)));
195Assert.False(File.Exists(Path.Combine(workspace.Path, AspireConfigFile.FileName)));
229var parentPath = Path.Combine(workspace.Path, AspireConfigFile.FileName);
411var rootPath = Path.Combine(workspace.Path, AspireConfigFile.FileName);
589new DirectoryInfo(workspace.Path + Path.DirectorySeparatorChar), CancellationToken.None);
658var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
767var repository = System.IO.Path.Combine(workspace.Path, "local\nrepository");
839Assert.False(File.Exists(Path.Combine(workspace.Path, AspireConfigFile.FileName)));
1129Assert.False(File.Exists(Path.Combine(workspace.Path, AspireConfigFile.FileName)));
1136var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
1145Assert.True(AspireConfigFile.Load(workspace.Path)!.ConfigSource!.OptOut);
1157var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
1183var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
1219var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
1253Assert.False(File.Exists(Path.Combine(workspace.Path, AspireConfigFile.FileName)));
1262var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
1294await Verify(await File.ReadAllTextAsync(Path.Combine(workspace.Path, AspireConfigFile.FileName)), "json");
1326var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
1347var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
1369var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
1383var config = AspireConfigFile.Load(workspace.Path)!;
1398var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
1421var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
1447var config = AspireConfigFile.Load(workspace.Path)!;
1458var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
1480var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
1535var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
1840var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
1872var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
1902Assert.Equivalent(s_appliedSource, AspireConfigFile.Load(workspace.Path)!.ConfigSource, strict: true);
1931Assert.Equivalent(changed, AspireConfigFile.Load(workspace.Path)!.ConfigSource, strict: true);
1939var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
1962var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
1996var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
2067Assert.Equivalent(invalid, AspireConfigFile.Load(workspace.Path)!.ConfigSource, strict: true);
2091var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
2165Assert.Equal("version-2", AspireConfigFile.Load(workspace.Path)!.ConfigSource!.AppliedVersion);
2186Assert.Equal("version-1", AspireConfigFile.Load(workspace.Path)!.ConfigSource!.AppliedVersion);
2218Assert.False(File.Exists(Path.Combine(workspace.Path, AspireConfigFile.FileName)));
Configuration\ConfigurationHelperTests.cs (37)
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));
83var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
96var staging = Assert.Single(Directory.GetFiles(workspace.Path, "*.tmp"));
114var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
122Assert.Equal([path], Directory.GetFiles(workspace.Path));
140targetDirectory = Path.Combine(workspace.Path, "linked-shared");
168var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
169var targetPath = Path.Combine(workspace.Path, "shared", AspireConfigFile.FileName);
176Assert.Equal(path, Assert.Single(Directory.GetFiles(workspace.Path)));
184var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
185var otherPath = Path.Combine(workspace.Path, "other.json");
194Assert.Equal(2, Directory.GetFiles(workspace.Path).Length);
210var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
221Assert.Equal(path, Assert.Single(Directory.GetFiles(workspace.Path)));
234var file = new FileInfo(Path.Combine(workspace.Path, AspireConfigFile.FileName));
247Assert.Equal(file.FullName, Assert.Single(Directory.GetFiles(workspace.Path)));
260var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
281Assert.Equal(path, Assert.Single(Directory.GetFiles(workspace.Path)));
296var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
315var staging = Assert.Single(Directory.GetFiles(workspace.Path, "*.tmp"));
332Assert.Equal(path, Assert.Single(Directory.GetFiles(workspace.Path)));
368var path = Path.Combine(workspace.Path, AspireConfigFile.FileName);
389Assert.Equal(path, Assert.Single(Directory.GetFiles(workspace.Path)));
509"legacy-local" => ConfigurationHelper.BuildPathToSettingsJsonFile(workspace.Path),
510_ => Path.Combine(workspace.Path, AspireConfigFile.FileName)
532var originalFiles = Directory.GetFiles(workspace.Path, "*", SearchOption.AllDirectories)
556Assert.Equal(originalFiles.Keys.Order(), Directory.GetFiles(workspace.Path, "*", SearchOption.AllDirectories).Order());
744var settingsPath = Path.Combine(workspace.Path, AspireConfigFile.FileName);
758var globalSettingsFile = new FileInfo(Path.Combine(workspace.Path, "global-settings.json"));
764var config = AspireConfigFile.Load(workspace.Path)!;
779var settingsPath = Path.Combine(workspace.Path, AspireConfigFile.FileName);
800var 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") }, new Aspire.Shared.TemporaryStorage());
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") }, new Aspire.Shared.TemporaryStorage());
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") }, new Aspire.Shared.TemporaryStorage());
239new TestConfigurationService { SettingsFilePath = Path.Combine(workspace.Path, "global.json") }, new Aspire.Shared.TemporaryStorage());
303new TestConfigurationService { SettingsFilePath = Path.Combine(workspace.Path, "global.json") }, new Aspire.Shared.TemporaryStorage());
NuGet\NuGetClientTests.cs (16)
48.Save(Path.Combine(workspace.Path, "nuget.config"));
51workspace.Path, fallback.FullName, sensitiveSources: [], bypassCaches: true, TestContext.Current.CancellationToken);
56(packageId, version), restoreDirectory.FullName, workspace.Path, packages.FullName,
99workingDirectory: workspace.Path, TestContext.Current.CancellationToken);
165workingDirectory: workspace.Path, TestContext.Current.CancellationToken);
180await File.WriteAllTextAsync(Path.Combine(workspace.Path, "nuget.config"), """
188"example.package", workspace.Path, TestContext.Current.CancellationToken);
201await File.WriteAllTextAsync(Path.Combine(workspace.Path, "nuget.config"), $$"""
215"Example.Package", workspace.Path, TestContext.Current.CancellationToken);
224await File.WriteAllTextAsync(Path.Combine(workspace.Path, "nuget.config"),
228"Aspire.Hosting.Dotnet", workspace.Path, TestContext.Current.CancellationToken);
459var configPath = Path.Combine(workspace.Path, "NuGet.Config");
469workspace.Path);
474var results = client.FilterPackageSearchResults(resolvedPackages, configPath, workspace.Path);
493var configPath = Path.Combine(workspace.Path, "NuGet.Config");
507configPath, workspace.Path));
NuGet\NuGetConfigurationQueryTests.cs (9)
25var configPath = Path.Combine(workspace.Path, "nuget.config");
55new TestConfigurationService { SettingsFilePath = Path.Combine(workspace.Path, "global.json") }, new Aspire.Shared.TemporaryStorage());
83var configPath = Path.Combine(workspace.Path, "nuget.config");
116new TestConfigurationService { SettingsFilePath = Path.Combine(workspace.Path, "global.json") }, new Aspire.Shared.TemporaryStorage());
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(), new Aspire.Shared.TemporaryStorage(), NullLogger.Instance));
126var executable = Path.Combine(workspace.Path, "server");
128using var project = new NativeAppHostServerProject(workspace.Path, executable, new TestProcessExecutionFactory(), new Aspire.Shared.TemporaryStorage(), 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(), new Aspire.Shared.TemporaryStorage(), 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, new Aspire.Shared.TemporaryStorage(), NullLogger.Instance))
218var executable = Path.Combine(workspace.Path, "server");
239using var project = new NativeAppHostServerProject(workspace.Path, executable, processes, new Aspire.Shared.TemporaryStorage(), NullLogger.Instance);
258var executable = Path.Combine(workspace.Path, "server");
272using var project = new NativeAppHostServerProject(workspace.Path, executable, factory, new Aspire.Shared.TemporaryStorage(), 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, new Aspire.Shared.TemporaryStorage(), NullLogger.Instance)
375var executable = Path.Combine(workspace.Path, "server");
383using var project = new NativeAppHostServerProject(workspace.Path, executable, processes, new Aspire.Shared.TemporaryStorage(), 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, new Aspire.Shared.TemporaryStorage(), logger)
495LayoutLease = new BundleLayoutLease(new LayoutConfiguration { LayoutPath = workspace.Path }, null)
Projects\PrebuiltAppHostServerTests.cs (7)
269new TestConfigurationService { SettingsFilePath = Path.Combine(workspace.Path, "global.json") }, new Aspire.Shared.TemporaryStorage())
353await File.WriteAllTextAsync(Path.Combine(workspace.Path, AspireConfigFile.FileName), $$"""
378var configPath = Path.Combine(workspace.Path, "NuGet.Config");
391new TestConfigurationService { SettingsFilePath = Path.Combine(workspace.Path, "global.json") }, new Aspire.Shared.TemporaryStorage())
398var plan = await resolver.ResolveAsync(workspace.Path, "test-apphost", sdkVersion, channelName,
404workspace.Path, sources: restoreConfiguration.Sources,
2401new TestConfigurationService { SettingsFilePath = Path.Combine(workspace.Path, "global.json") }, new Aspire.Shared.TemporaryStorage())
Projects\ProjectUpdaterNuGetConfigurationTests.cs (42)
57var configFile = new FileInfo(Path.Combine(workspace.Path, "NuGet.Config"));
110Assert.Empty(Directory.EnumerateDirectories(Path.Combine(workspace.Path, ".aspire"), ".aspire-nuget-config-*"));
153Assert.Empty(Directory.EnumerateDirectories(Path.Combine(workspace.Path, ".aspire"), ".aspire-nuget-config-*"));
179var configPath = Path.Combine(workspace.Path, AspireConfigFile.FileName);
259var config = AspireConfigFile.Load(workspace.Path);
295var propsPath = Path.Combine(workspace.Path, "Directory.Build.props");
404var aspireConfigPath = Path.Combine(workspace.Path, AspireConfigFile.FileName);
497var aspireConfig = AspireConfigFile.Load(workspace.Path);
520Assert.Empty(Directory.EnumerateDirectories(Path.Combine(workspace.Path, ".aspire"), ".aspire-nuget-config-*"));
550Assert.False(File.Exists(Path.Combine(workspace.Path, "nuget.config")));
551Assert.Empty(Directory.EnumerateDirectories(Path.Combine(workspace.Path, ".aspire"), ".aspire-nuget-config-*"));
579var configFile = new FileInfo(Path.Combine(workspace.Path, "NuGet.Config"));
682var configFile = new FileInfo(Path.Combine(workspace.Path, "NuGet.Config"));
690var projectFile = new FileInfo(Path.Combine(workspace.Path, "apphost.cs"));
700var aspireConfigPath = Path.Combine(workspace.Path, AspireConfigFile.FileName);
751Assert.Equal(newVersion, AspireConfigFile.Load(workspace.Path)!.SdkVersion);
782var file = new FileInfo(Path.Combine(workspace.Path, fileName));
812await File.WriteAllTextAsync(Path.Combine(workspace.Path, AspireConfigFile.FileName),
859Assert.Empty(Directory.EnumerateDirectories(Path.Combine(workspace.Path, ".aspire"), ".aspire-nuget-config-*"));
876var channelSourceKey = $"aspire-{AppHostWorkloadId.Create(workspace.Path)}";
894var configFile = new FileInfo(Path.Combine(workspace.Path, "NuGet.Config"));
943NuGetTestHelper.GetEligiblePackageSources(workspace.Path, "Aspire.Hosting.Redis").Order());
945.GetNuGetSettings(workspace.Path, TestContext.Current.CancellationToken);
974var configFile = new FileInfo(Path.Combine(workspace.Path, "NuGet.Config"));
1010options.NuGetRestoreTargetsFile?.DirectoryName ?? workspace.Path, "Aspire.Hosting.Redis").Order());
1040NuGetTestHelper.GetEligiblePackageSources(workspace.Path, "Aspire.Hosting.Redis").Order());
1042.GetNuGetSettings(workspace.Path, TestContext.Current.CancellationToken);
1103await File.WriteAllTextAsync(Path.Combine(workspace.Path, AspireConfigFile.FileName),
1133var aspireConfigPath = Path.Combine(workspace.Path, AspireConfigFile.FileName);
1203var parentConfig = new FileInfo(Path.Combine(workspace.Path, "NuGet.Config"));
1364var aspireConfigPath = Path.Combine(workspace.Path, AspireConfigFile.FileName);
1500Assert.Empty(Directory.EnumerateFiles(workspace.Path, ".aspire-nuget-candidate-*"));
1501Assert.Empty(Directory.EnumerateDirectories(Path.Combine(workspace.Path, ".aspire"), ".aspire-nuget-config-*"));
1619Assert.Empty(Directory.EnumerateFiles(workspace.Path, ".aspire-nuget-candidate-*"));
1636var propsFile = new FileInfo(Path.Combine(workspace.Path, "Directory.Packages.props"));
1691await File.WriteAllTextAsync(Path.Combine(workspace.Path, "NuGet.Config"),
1694var childDirectory = Directory.CreateDirectory(Path.Combine(workspace.Path, "Child"));
1787var configFile = new FileInfo(Path.Combine(workspace.Path, "NuGet.Config"));
1821var configPath = Path.Combine(workspace.Path, "NuGet.Config");
1870var configPath = Path.Combine(workspace.Path, "NuGet.Config");
1906Assert.Equal([privateSource], NuGetTestHelper.GetEligiblePackageSources(workspace.Path, "Aspire.Hosting.Redis"));
1939var 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\DcpConnectionHealthCheckTests.cs (12)
245var result = await checker.TestConnectionAsync(workspace.Path, useDeveloperCertificate: true, TestContext.Current.CancellationToken);
261var connection = checker.TestConnectionAsync(workspace.Path, useDeveloperCertificate: false, cancellation.Token);
279var result = await checker.TestConnectionAsync(workspace.Path, useDeveloperCertificate: false, TestContext.Current.CancellationToken);
295var result = await checker.TestConnectionAsync(workspace.Path, useDeveloperCertificate: false, TestContext.Current.CancellationToken);
323var connection = checker.TestConnectionAsync(workspace.Path, useDeveloperCertificate: false, cancellation.Token);
349() => checker.TestConnectionAsync(workspace.Path, useDeveloperCertificate: false, cancellation.Token));
392var result = await checker.TestConnectionAsync(workspace.Path, useDeveloperCertificate: false, TestContext.Current.CancellationToken);
413var result = await checker.TestConnectionAsync(workspace.Path, useDeveloperCertificate: false, TestContext.Current.CancellationToken);
429var result = await checker.TestConnectionAsync(workspace.Path, useDeveloperCertificate: false, TestContext.Current.CancellationToken);
661options.StartInfo.Environment["HOME"] = workspace.Path;
662options.StartInfo.Environment["USERPROFILE"] = workspace.Path;
683}, workspace.Path, options).Dispose();
Utils\TemporaryStorageTests.cs (10)
17var home = Path.Combine(workspace.Path, ".aspire");
52var home = Path.Combine(workspace.Path, ".aspire");
69using var storage = CreateStorage(Path.Combine(workspace.Path, ".aspire"), value);
79using var storage = CreateStorage(Path.Combine(workspace.Path, ".aspire"));
88var home = Path.Combine(workspace.Path, "missing", ".aspire");
106var home = Directory.CreateDirectory(Path.Combine(workspace.Path, ".aspire"));
144var home = Path.Combine(workspace.Path, ".aspire");
166var home = Directory.CreateDirectory(Path.Combine(workspace.Path, ".aspire"));
188var home = Path.Combine(workspace.Path, ".aspire");
195Directory.CreateSymbolicLink(root, workspace.Path);
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,