8422 references to File
aspire (490)
Agents\AspireSkills\AspireSkillsInstaller.cs (24)
538await using var fileStream = File.Create(archivePath);
670!File.Exists(Path.Combine(cacheDirectory, GitHubAttestationVerifiedFileName)))
681var cachedArchiveSha512 = File.Exists(cachedArchiveSha512Path)
682? TryNormalizeArchiveSha512(File.ReadAllText(cachedArchiveSha512Path).Trim())
694var cachedGitHubArchiveSha256 = File.Exists(cachedGitHubArchiveSha256Path)
695? TryNormalizeArchiveSha256(File.ReadAllText(cachedGitHubArchiveSha256Path).Trim())
765await File.WriteAllTextAsync(
774await File.WriteAllTextAsync(
782await File.WriteAllTextAsync(
827File.Delete(Path.Combine(bundleDirectory, ArchiveSha512FileName));
828File.Delete(Path.Combine(bundleDirectory, GitHubArchiveSha256FileName));
829File.Delete(Path.Combine(bundleDirectory, GitHubAttestationVerifiedFileName));
830File.Delete(Path.Combine(bundleDirectory, LastUsedFileName));
934using var stream = File.OpenRead(archivePath);
940using var stream = File.OpenRead(archivePath);
1068File.Exists(Path.Combine(versionCacheDirectory, "skill-manifest.json")) ||
1069File.Exists(Path.Combine(versionCacheDirectory, ArchiveSha512FileName)) ||
1070File.Exists(Path.Combine(versionCacheDirectory, GitHubArchiveSha256FileName)) ||
1071File.Exists(Path.Combine(versionCacheDirectory, GitHubAttestationVerifiedFileName)) ||
1072File.Exists(Path.Combine(versionCacheDirectory, LastUsedFileName));
1109File.WriteAllText(Path.Combine(directory, LastUsedFileName), DateTimeOffset.UtcNow.ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture));
1120if (File.Exists(markerPath) &&
1121long.TryParse(File.ReadAllText(markerPath), NumberStyles.Integer, CultureInfo.InvariantCulture, out var unixTime) &&
1161File.Delete(path);
Agents\DeprecatedMcpCommandScanner.cs (13)
46File.AppendAllText(debugPath, $"[{DateTime.UtcNow:O}] Scanning context.RepositoryRoot: {context.RepositoryRoot.FullName}\n");
51File.AppendAllText(debugPath, $"[{DateTime.UtcNow:O}] Checking {location.AgentName}: {configPath}\n");
53if (!File.Exists(configPath))
55File.AppendAllText(debugPath, $"[{DateTime.UtcNow:O}] -> File does not exist\n");
59File.AppendAllText(debugPath, $"[{DateTime.UtcNow:O}] -> File EXISTS!\n");
63var content = File.ReadAllText(configPath);
64File.AppendAllText(debugPath, $"[{DateTime.UtcNow:O}] -> Content: {content.Substring(0, Math.Min(200, content.Length))}\n");
69File.AppendAllText(debugPath, $"[{DateTime.UtcNow:O}] -> JSON parse returned null\n");
74File.AppendAllText(debugPath, $"[{DateTime.UtcNow:O}] -> HasDeprecatedMcpCommand: {hasDeprecated}\n");
83File.AppendAllText(debugPath, $"[{DateTime.UtcNow:O}] -> Added applicator\n");
88File.AppendAllText(debugPath, $"[{DateTime.UtcNow:O}] -> JsonException: {ex.Message}\n");
93File.AppendAllText(debugPath, $"[{DateTime.UtcNow:O}] -> IOException: {ex.Message}\n");
214await File.WriteAllTextAsync(configPath, jsonContent, cancellationToken);
Layout\LayoutDiscovery.cs (10)
263_logger.LogDebug(" {Dir}/{Managed}/{Exe}: {Exists}", BundleDiscovery.BundleDirectoryName, BundleDiscovery.ManagedDirectoryName, managedExeName, File.Exists(bundleManagedExe) ? "exists" : "MISSING");
264_logger.LogDebug(" {Dir}/{Dcp}/{Exe}: {Exists}", BundleDiscovery.BundleDirectoryName, BundleDiscovery.DcpDirectoryName, Path.GetFileName(bundleDcpExe), File.Exists(bundleDcpExe) ? "exists" : "MISSING");
266if (File.Exists(bundleManagedExe) && File.Exists(bundleDcpExe))
297_logger.LogDebug(" managed/{ManagedExe}: {Exists}", managedExeName, File.Exists(managedExePath) ? "exists" : "MISSING");
298_logger.LogDebug(" dcp/{DcpExe}: {Exists}", Path.GetFileName(dcpExePath), File.Exists(dcpExePath) ? "exists" : "MISSING");
300if (!File.Exists(managedExePath) || !File.Exists(dcpExePath))
337if (managedPath is null || !File.Exists(managedPath))
347!File.Exists(BundleDiscovery.GetDcpExecutablePath(dcpPath)))
Projects\JavaAppHostToolchainResolver.cs (11)
131if (File.Exists(Path.Combine(candidate.FullName, MavenPomFileName)))
138if (File.Exists(Path.Combine(candidate.FullName, gradleBuildFileName)))
194if (File.Exists(candidate)
205if (Directory.Exists(gitPath) || File.Exists(gitPath))
221JavaAppHostToolchain.Gradle => File.Exists(Path.Combine(directory, GradleSettingsFileName))
222|| File.Exists(Path.Combine(directory, GradleKotlinSettingsFileName)),
225JavaAppHostToolchain.Maven => File.Exists(Path.Combine(directory, MavenPomFileName)),
257return (File.GetUnixFileMode(path) & UnixFileMode.OtherWrite) != 0;
417await File.WriteAllTextAsync(temporaryPath, GradleInitScript, cancellationToken).ConfigureAwait(false);
418File.Move(temporaryPath, scriptPath, overwrite: true);
424File.Delete(temporaryPath);
Scaffolding\ScaffoldingService.cs (15)
192if (fileName.Equals(PackageJsonFileName, StringComparison.OrdinalIgnoreCase) && File.Exists(filePath))
194var existingContent = await File.ReadAllTextAsync(filePath, cancellationToken);
201else if (IsGitIgnoreFile(fileName) && File.Exists(filePath))
203var existingContent = await File.ReadAllTextAsync(filePath, cancellationToken);
206else if (IsVsCodeSettingsFile(fileName) && File.Exists(filePath))
208var existingContent = await File.ReadAllTextAsync(filePath, cancellationToken);
212await File.WriteAllTextAsync(filePath, contentToWrite, cancellationToken);
245if (profiles is not null && File.Exists(appHostRunPath))
250File.Delete(appHostRunPath);
268if (IsTypeScriptLanguage(language) && File.Exists(Path.Combine(directory.FullName, PackageJsonFileName)))
295var existingContent = await File.ReadAllTextAsync(packageJsonPath, cancellationToken);
322await File.WriteAllTextAsync(packageJsonPath, serializedPackageJson, cancellationToken);
496await File.WriteAllTextAsync(filePath, content, cancellationToken);
509!File.Exists(Path.Combine(directory.FullName, PackageJsonFileName)) ||
550if (File.Exists(filePath) || Directory.Exists(filePath))
aspire-managed (24)
Aspire.Acquisition.Tests (141)
Scripts\PRScriptInstallerModeTests.cs (35)
37await File.WriteAllTextAsync(Path.Combine(root, "aspire.rb"), "cask \"aspire\" do\n version \"13.3.0\"\nend\n");
38await File.WriteAllTextAsync(Path.Combine(root, "dogfood.sh"), "#!/usr/bin/env bash\nexit 0\n");
47await File.WriteAllTextAsync(Path.Combine(root, "Microsoft.Aspire.installer.yaml"), "PackageIdentifier: Microsoft.Aspire\nPackageVersion: 13.3.0\nInstallers: []\n");
48await File.WriteAllTextAsync(Path.Combine(root, "dogfood.ps1"), "exit 0\n");
94await File.WriteAllTextAsync(Path.Combine(manifestDir, "Microsoft.Aspire.installer.yaml"), installerYaml);
95await File.WriteAllTextAsync(Path.Combine(manifestDir, "Microsoft.Aspire.yaml"), $"PackageIdentifier: Microsoft.Aspire\nPackageVersion: {version}\nManifestType: version\nManifestVersion: 1.10.0\n");
96await File.WriteAllTextAsync(Path.Combine(manifestDir, "Microsoft.Aspire.locale.en-US.yaml"), $"PackageIdentifier: Microsoft.Aspire\nPackageVersion: {version}\nPackageLocale: en-US\nManifestType: defaultLocale\nManifestVersion: 1.10.0\n");
97await File.WriteAllTextAsync(Path.Combine(manifestDir, "dogfood.ps1"), "exit 0\n");
121await File.WriteAllTextAsync(brewPath, $$"""
195await File.WriteAllTextAsync(curlPath, """
235await File.WriteAllTextAsync(implPath, $$"""
370await File.WriteAllTextAsync(wingetCmd, """
376await File.WriteAllTextAsync(aspireCmd, $$"""
388await File.WriteAllTextAsync(Path.Combine(root, "aspire-cli-osx-arm64-13.3.0.tar.gz"), "fake arm64 archive");
389await File.WriteAllTextAsync(Path.Combine(root, "aspire-cli-osx-x64-13.3.0.tar.gz"), "fake x64 archive");
405var bytes = await File.ReadAllBytesAsync(path);
422if (File.Exists(path))
424File.Delete(path);
427await using var fs = File.Create(path);
581await File.WriteAllTextAsync(caskPath, "cask \"aspire\" do\n version \"13.3.0\"\nend\n");
616var brewLog = await File.ReadAllTextAsync(Path.Combine(env.TempDirectory, "brew.log"));
642var cask = await File.ReadAllTextAsync(Path.Combine(outputDir, "aspire.rb"));
649Assert.True(File.Exists(Path.Combine(outputDir, "dogfood.sh")));
658var brewLog = await File.ReadAllTextAsync(Path.Combine(env.TempDirectory, "brew.log"));
772var installerManifest = await File.ReadAllTextAsync(Path.Combine(outputDir, "Microsoft.Aspire.installer.yaml"));
781var localeManifest = await File.ReadAllTextAsync(Path.Combine(outputDir, "Microsoft.Aspire.locale.en-US.yaml"));
783Assert.True(File.Exists(Path.Combine(outputDir, "Microsoft.Aspire.yaml")));
784Assert.True(File.Exists(Path.Combine(outputDir, "dogfood.ps1")));
801var wingetLog = await File.ReadAllTextAsync(Path.Combine(env.TempDirectory, "winget.log"));
848var wingetLog = await File.ReadAllTextAsync(Path.Combine(env.TempDirectory, "winget.log"));
853var originalInstaller = await File.ReadAllTextAsync(Path.Combine(manifestDir, "Microsoft.Aspire.installer.yaml"));
921var installerYaml = await File.ReadAllTextAsync(Path.Combine(outputDir, "Microsoft.Aspire.installer.yaml"));
932Assert.True(File.Exists(expected),
954File.Delete(x64Archive);
955await using (var fs = File.Create(x64Archive))
Scripts\PRScriptPSFunctionTests.cs (7)
104Assert.Contains(cliBinDir, await File.ReadAllLinesAsync(githubPath));
262File.WriteAllText(Path.Combine(tempDir, "artifact.tar.gz"), "fake");
282File.WriteAllText(Path.Combine(tempDir, "artifact.tar.gz"), "fake");
302File.WriteAllText(Path.Combine(tempDir, "artifact.tar.gz"), "fake");
326await File.WriteAllTextAsync(Path.Combine(downloadDir, "README.txt"), "no archive here");
348await File.WriteAllTextAsync(Path.Combine(downloadDir, "aspire-cli-linux-x64.tar.gz"), "fake1");
349await File.WriteAllTextAsync(Path.Combine(downloadDir, "aspire-cli-osx-arm64.tar.gz"), "fake2");
Scripts\PRScriptToolModeTests.cs (22)
120await File.WriteAllTextAsync(dotnetScriptPath, scriptContent);
407var dotnetCommands = await File.ReadAllTextAsync(dotnetCommandsPath, TestContext.Current.CancellationToken);
436var dotnetCommands = await File.ReadAllTextAsync(dotnetCommandsPath, TestContext.Current.CancellationToken);
446Assert.True(File.Exists(Path.Combine(prHive, "Aspire.Hosting.13.3.0-pr.5678.deadbeef.nupkg")),
476var dotnetCommands = await File.ReadAllTextAsync(dotnetCommandsPath, TestContext.Current.CancellationToken);
507Assert.False(File.Exists(sidecarPath), $"Tool mode must not write the PR-route sidecar at {sidecarPath}.");
512Assert.True(File.Exists(Path.Combine(prHive, "Aspire.Hosting.13.3.0-pr.5678.deadbeef.nupkg")),
515var dotnetCommands = await File.ReadAllTextAsync(dotnetCommandsPath, TestContext.Current.CancellationToken);
631await File.WriteAllTextAsync(Path.Combine(pkgDir, "Aspire.Cli.13.3.0-pr.5678.deadbeef.symbols.nupkg"), "fake-symbols-nupkg-content");
632await File.WriteAllTextAsync(Path.Combine(pkgDir, "Aspire.Cli.13.3.0-pr.5678.deadbeef.snupkg"), "fake-symbols-package-content");
634await File.WriteAllTextAsync(Path.Combine(pkgDir, "Aspire.Cli.13_3_0.nupkg"), "fake-invalid-version-content");
657await File.WriteAllTextAsync(Path.Combine(pkgDir, "Aspire.Cli.1_0.nupkg"), "fake-invalid-version-content");
983var dotnetCommands = await File.ReadAllTextAsync(dotnetCommandsPath, TestContext.Current.CancellationToken);
1012var dotnetCommands = await File.ReadAllTextAsync(dotnetCommandsPath, TestContext.Current.CancellationToken);
1022Assert.True(File.Exists(Path.Combine(prHive, "Aspire.Hosting.13.3.0-pr.5678.deadbeef.nupkg")),
1051Assert.False(File.Exists(sidecarPath), $"Tool mode must not write the PR-route sidecar at {sidecarPath}.");
1056Assert.True(File.Exists(Path.Combine(prHive, "Aspire.Hosting.13.3.0-pr.5678.deadbeef.nupkg")),
1059var dotnetCommands = await File.ReadAllTextAsync(dotnetCommandsPath, TestContext.Current.CancellationToken);
1158await File.WriteAllTextAsync(Path.Combine(pkgDir, "Aspire.Cli.13.3.0-pr.5678.deadbeef.symbols.nupkg"), "fake-symbols-nupkg-content");
1159await File.WriteAllTextAsync(Path.Combine(pkgDir, "Aspire.Cli.13.3.0-pr.5678.deadbeef.snupkg"), "fake-symbols-package-content");
1161await File.WriteAllTextAsync(Path.Combine(pkgDir, "Aspire.Cli.13_3_0.nupkg"), "fake-invalid-version-content");
1183await File.WriteAllTextAsync(Path.Combine(pkgDir, "Aspire.Cli.1_0.nupkg"), "fake-invalid-version-content");
Scripts\ReleaseScriptFunctionTests.cs (12)
316Assert.True(File.Exists(Path.Combine(destPath, "aspire")),
337Assert.True(File.Exists(Path.Combine(destPath, "aspire.exe")),
439await File.WriteAllTextAsync(cliPath, ($$"""
455Assert.Equal("setup", (await File.ReadAllTextAsync(capturePath)).Trim());
513File.WriteAllText(Path.Combine(env.MockHome, ".bashrc"), "# existing config\n");
525var bashrcContent = File.ReadAllText(Path.Combine(env.MockHome, ".bashrc"));
537File.WriteAllText(Path.Combine(env.MockHome, ".zshrc"), "# existing config\n");
549var zshrcContent = File.ReadAllText(Path.Combine(env.MockHome, ".zshrc"));
562File.WriteAllText(
576var bashrcContent = File.ReadAllText(Path.Combine(env.MockHome, ".bashrc"));
613await File.WriteAllTextAsync(mockCurl,
650await File.WriteAllTextAsync(mockCurl,
Aspire.Cli.EndToEnd.Tests (368)
BundleSmokeTests.cs (20)
71Assert.True(File.Exists(appHostProjectPath), $"Expected AppHost project file to exist at: {appHostProjectPath}");
72Assert.True(File.Exists(appHostSourcePath), $"Expected AppHost source file to exist at: {appHostSourcePath}");
74var appHostProject = File.ReadAllText(appHostProjectPath);
78File.WriteAllText(
102Assert.True(File.Exists(argsOutputPath), $"Expected AppHost to write forwarded args to: {argsOutputPath}");
103Assert.Equal("--from-dotnet-run", File.ReadAllText(argsOutputPath));
136Assert.True(File.Exists(appHostProjectPath), $"Expected AppHost project file to exist at: {appHostProjectPath}");
137Assert.True(File.Exists(appHostSourcePath), $"Expected AppHost source file to exist at: {appHostSourcePath}");
139var appHostProject = File.ReadAllText(appHostProjectPath);
147File.WriteAllText(appHostProjectPath, appHostProject);
149var appHostSource = File.ReadAllText(appHostSourcePath);
150File.WriteAllText(
197Assert.True(File.Exists(argsOutputPath), $"Expected AppHost to write forwarded args to: {argsOutputPath}");
198Assert.Equal("--from-real-dnx", File.ReadAllText(argsOutputPath));
227Assert.True(File.Exists(appHostSourcePath), $"Expected AppHost source file to exist at: {appHostSourcePath}");
229var appHostSource = File.ReadAllText(appHostSourcePath);
230var sdkDirective = File.ReadLines(appHostSourcePath).First();
235File.WriteAllText(
258Assert.True(File.Exists(argsOutputPath), $"Expected AppHost to write forwarded args to: {argsOutputPath}");
259Assert.Equal("--from-dotnet-run-file", File.ReadAllText(argsOutputPath));
CentralPackageManagementTests.cs (13)
52File.WriteAllText(appHostCsprojPath, """
66File.WriteAllText(Path.Combine(appHostDir, "Program.cs"), """
71File.WriteAllText(directoryPackagesPropsPath, """
95var content = File.ReadAllText(directoryPackagesPropsPath);
166File.WriteAllText(appHostCsprojPath, """
177File.WriteAllText(Path.Combine(appHostDir, "Program.cs"), """
183File.WriteAllText(directoryPackagesPropsPath, """
203var migratedCsproj = File.ReadAllText(appHostCsprojPath);
218File.WriteAllText(directoryPackagesPropsPath, $$"""
244var content = File.ReadAllText(directoryPackagesPropsPath);
287File.WriteAllText(appHostCsprojPath, """
297File.WriteAllText(Path.Combine(appHostDir, "Program.cs"), """
302File.WriteAllText(directoryPackagesPropsPath, """
ConfigDiscoveryTests.cs (17)
59Assert.True(File.Exists(primaryConfigPath), $"Expected Primary config at: {primaryConfigPath}");
60Assert.True(File.Exists(alternateConfigPath), $"Expected Alternate config at: {alternateConfigPath}");
61Assert.True(File.Exists(alternateAppHostPath), $"Expected Alternate AppHost source file to exist at: {alternateAppHostPath}");
65File.Delete(primaryConfigPath);
66File.Delete(alternateConfigPath);
71var alternateAppHostSource = File.ReadAllText(alternateAppHostPath);
73File.WriteAllText(
93File.WriteAllBytes(workspaceConfigPath, originalWorkspaceConfigBytes);
123Assert.True(File.Exists(alternateRunMarkerPath), $"Expected the Alternate AppHost to run and write: {alternateRunMarkerPath}");
124Assert.Equal("alternate", File.ReadAllText(alternateRunMarkerPath));
125Assert.Equal(originalWorkspaceConfigBytes, File.ReadAllBytes(workspaceConfigPath));
126Assert.False(File.Exists(alternateConfigPath), $"Explicit alternate AppHost should not create a local config at: {alternateConfigPath}");
167Assert.True(File.Exists(projectConfigPath),
170var originalContent = File.ReadAllText(projectConfigPath);
200Assert.False(File.Exists(parentConfigPath),
205Assert.True(File.Exists(projectConfigPath),
208var currentContent = File.ReadAllText(projectConfigPath);
Helpers\CliInstallStrategyTests.cs (7)
480File.WriteAllText(Path.Combine(tempDir.FullName, "Aspire.Cli.13.3.0-preview.1.25175.1.nupkg"), "");
481File.WriteAllText(Path.Combine(tempDir.FullName, "Aspire.Cli.linux-x64.13.3.0-preview.1.25175.1.nupkg"), "");
777File.WriteAllText(Path.Combine(tempDir.FullName, "Aspire.Cli.13.3.0-preview.1.12345.1.nupkg"), "");
795File.WriteAllText(Path.Combine(tempDir.FullName, "Aspire.Cli.linux-x64.13.3.0.nupkg"), "");
813File.WriteAllText(Path.Combine(tempDir.FullName, "Aspire.Cli.13.3.0.nupkg"), "");
814File.WriteAllText(Path.Combine(tempDir.FullName, "Aspire.Cli.13.4.0.nupkg"), "");
833File.WriteAllText(Path.Combine(tempDir.FullName, "Aspire.Cli.linux-x64.13.3.0.nupkg"), "");
JavaScriptPublishTests.cs (7)
146File.WriteAllText(appHostPath, """
179File.WriteAllText(appHostPath, $$"""
220File.WriteAllText(Path.Combine(appDir, "package.json"), $$"""
235File.WriteAllText(Path.Combine(appDir, "yarn.lock"), $$"""
252File.WriteAllText(Path.Combine(appDir, "server.js"), $$"""
277File.WriteAllText(Path.Combine(workspace.WorkspaceRoot.FullName, "verify-runtime.sh"), $$"""
330File.Copy(file, Path.Combine(workspace.WorkspaceRoot.FullName, Path.GetFileName(file)));
TypeScriptEmptyAppHostTemplateTests.cs (8)
41var appHostContents = await File.ReadAllTextAsync(appHostPath, TestContext.Current.CancellationToken);
58await File.WriteAllTextAsync(appHostPath, appHostContents, TestContext.Current.CancellationToken);
108File.WriteAllText(Path.Combine(extensionDirectory.FullName, "DeadlockExtension.csproj"), $$"""
123File.WriteAllText(Path.Combine(extensionDirectory.FullName, "DeadlockExtensions.cs"), """
163File.WriteAllText(Path.Combine(appDirectory, "apphost.mts"), """
178var config = JsonNode.Parse(File.ReadAllText(configPath))?.AsObject()
184File.WriteAllText(configPath, config.ToJsonString(new JsonSerializerOptions { WriteIndented = true }));
190using var doc = JsonDocument.Parse(File.ReadAllText(configPath));
TypeScriptPolyglotTests.cs (20)
111File.WriteAllText(appHostPath, newContent);
123File.Exists(appHostLockFilePath),
130File.Exists(viteLockFilePath),
207File.WriteAllText(appHostPath, """
229File.Exists(appHostLockFilePath),
236File.Exists(guestLockFilePath),
285File.Exists(lockFilePath),
330File.WriteAllText(
353var packageJson = JsonNode.Parse(File.ReadAllText(Path.Combine(projectRoot, "package.json")))!.AsObject();
359originalTsConfig = File.ReadAllText(Path.Combine(projectRoot, "tsconfig.json"));
361File.WriteAllText(Path.Combine(projectRoot, "package.json"), packageJson.ToJsonString(new JsonSerializerOptions { WriteIndented = true }));
384packageJson = JsonNode.Parse(File.ReadAllText(Path.Combine(projectRoot, "package.json")))!.AsObject();
401Assert.Equal(originalTsConfig, File.ReadAllText(Path.Combine(projectRoot, "tsconfig.json")));
402Assert.False(File.Exists(Path.Combine(projectRoot, "tsconfig.apphost.json")));
403Assert.False(File.Exists(Path.Combine(projectRoot, "apphost.mts")));
407Assert.True(File.Exists(appHostPath));
409var appHostPackageJson = JsonNode.Parse(File.ReadAllText(Path.Combine(appHostDirectory, "package.json")))!.AsObject();
421Assert.True(File.Exists(Path.Combine(appHostDirectory, "tsconfig.apphost.json")));
425var config = JsonNode.Parse(File.ReadAllText(configPath))!.AsObject();
447File.WriteAllText(appHostPath, newContent);
TypeScriptReusablePackageTests.cs (10)
45Assert.True(File.Exists(appAppHostPath), $"Expected the CLI-created app to contain {appAppHostPath}.");
58Assert.False(File.Exists(helperAppHostPath), $"Config-only helper package unexpectedly contained {helperAppHostPath}.");
71Assert.Contains("addRedis", File.ReadAllText(Path.Combine(helperModulesDirectory, "aspire.mts")));
94using var doc = JsonDocument.Parse(File.ReadAllText(configPath));
101File.WriteAllText(Path.Combine(appDirectory.FullName, "apphost.mts"), """
113File.WriteAllText(Path.Combine(appDirectory.FullName, "tsconfig.json"), """
141File.WriteAllText(Path.Combine(helperDirectory.FullName, "aspire.config.json"), $$"""
155File.WriteAllText(Path.Combine(helperDirectory.FullName, "package.json"), """
171File.WriteAllText(Path.Combine(helperDirectory.FullName, "tsconfig.json"), """
194File.WriteAllText(Path.Combine(helperSourceDirectory.FullName, "index.ts"), """
Aspire.Cli.Tests (2017)
Acquisition\InstallationDiscoveryDiscoverAllTests.cs (26)
73File.WriteAllText(sidecarPath, "{\"source\":\"script\"}");
74var originalMode = File.GetUnixFileMode(sidecarPath);
78File.SetUnixFileMode(sidecarPath, UnixFileMode.None);
93File.SetUnixFileMode(sidecarPath, originalMode | UnixFileMode.UserRead | UnixFileMode.UserWrite);
105File.WriteAllText(sidecarPath, "{not valid json");
131File.WriteAllText(Path.Combine(binDir, InstallSidecarReader.SidecarFileName), "{\"source\":\"script\"}");
279File.WriteAllText(Path.Combine(prDir, InstallSidecarReader.SidecarFileName), "{\"source\":\"pr\"}");
303File.WriteAllText(Path.Combine(binDir, InstallSidecarReader.SidecarFileName), "{\"source\":\"script\"}");
328File.WriteAllText(Path.Combine(binDir, InstallSidecarReader.SidecarFileName), "{\"source\":\"script\"}");
369File.WriteAllText(Path.Combine(prDir, InstallSidecarReader.SidecarFileName), "{\"source\":\"pr\"}");
403File.WriteAllText(Path.Combine(prDir, InstallSidecarReader.SidecarFileName), "{\"source\":\"pr\"}");
438File.WriteAllText(Path.Combine(brewDir, InstallSidecarReader.SidecarFileName), "{\"source\":\"brew\"}");
474File.WriteAllText(Path.Combine(brewDir, InstallSidecarReader.SidecarFileName), "{\"source\":\"brew\"}");
639var originalMode = File.GetUnixFileMode(dogfoodRoot);
643File.SetUnixFileMode(dogfoodRoot, UnixFileMode.None);
666File.SetUnixFileMode(dogfoodRoot, originalMode | UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute);
682var originalMode = File.GetUnixFileMode(toolStore);
686File.SetUnixFileMode(toolStore, UnixFileMode.None);
716File.SetUnixFileMode(toolStore, originalMode | UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute);
765File.WriteAllText(Path.Combine(releaseBinDir, InstallSidecarReader.SidecarFileName), "{\"source\":\"script\"}");
795File.WriteAllText(Path.Combine(releaseBinDir, InstallSidecarReader.SidecarFileName), "{\"source\":\"localhive\"}");
862Assert.True(File.Exists(firmlinkedProcessPath), "firmlinked /private/var path should resolve to the same file");
957var resolved = File.ResolveLinkTarget(path, returnFinalTarget: true);
1010File.WriteAllBytes(path, [0x00]); // existence is what matters
1016File.SetUnixFileMode(path,
1027File.WriteAllText(Path.Combine(dir, InstallSidecarReader.SidecarFileName), $"{{\"source\":\"{source}\"}}");
Agents\AspireSkillsBundleTests.cs (14)
146await File.WriteAllTextAsync(skillPath, CreateSkillFileContent());
189await File.WriteAllTextAsync(Path.Combine(skillDirectory, "SKILL.md"), CreateSkillFileContent());
232await File.WriteAllTextAsync(Path.Combine(bundleDirectory, "skill-manifest.json"), "{");
510await File.WriteAllTextAsync(Path.Combine(bundleDirectory, "skills", CommonAgentApplicators.AspireSkillName, "SKILL.md"), CreateSkillFileContent());
558await File.WriteAllTextAsync(skillPath, CreateSkillFileContent());
640await File.WriteAllTextAsync(skillPath, skillContent);
663await File.WriteAllTextAsync(Path.Combine(bundleDirectory, "skill-manifest.json"), manifestJson);
685await File.WriteAllTextAsync(skillPath, CreateSkillFileContent());
805await File.WriteAllTextAsync(skillPath, "tampered");
844await File.WriteAllTextAsync(fullPath, content);
885await File.WriteAllTextAsync(Path.Combine(skillDirectory, "SKILL.md"), content);
908return File.WriteAllTextAsync(Path.Combine(bundleDirectory, "skill-manifest.json"), manifestJson);
913using var stream = File.OpenRead(path);
919using var stream = File.OpenRead(path);
Agents\AspireSkillsInstallerTests.cs (29)
229Assert.True(File.Exists(Path.Combine(
282Assert.False(File.Exists(Path.Combine(
345await File.ReadAllTextAsync(Path.Combine(
350await File.ReadAllTextAsync(Path.Combine(
407await File.ReadAllTextAsync(Path.Combine(
457Assert.False(File.Exists(Path.Combine(cachedBundleDirectory, "skill-manifest.json")));
464await File.ReadAllTextAsync(Path.Combine(
487await File.WriteAllTextAsync(Path.Combine(cachedBundleDirectory, "skill-manifest.json"), "{");
560await File.WriteAllTextAsync(
878Assert.True(File.Exists(Path.Combine(
1037Assert.False(File.Exists($"{activeTemporaryDirectory}.lock"));
1460Assert.True(File.Exists(Path.Combine(targetDirectory, "skill-manifest.json")));
1479await File.WriteAllBytesAsync(archivePath, archiveBytes);
1508await File.WriteAllBytesAsync(archivePath, archiveBytes);
1609await File.ReadAllTextAsync(Path.Combine(
1614await File.ReadAllTextAsync(Path.Combine(
1776Assert.False(File.Exists(Path.Combine(
2015await File.WriteAllTextAsync(skillPath,
2048await File.WriteAllTextAsync(Path.Combine(bundleDirectory, "skill-manifest.json"), manifestJson);
2052await File.WriteAllTextAsync(Path.Combine(bundleDirectory, AspireSkillsInstaller.ArchiveSha512FileName), archiveSha512);
2057await File.WriteAllTextAsync(
2064await File.WriteAllTextAsync(
2072return File.WriteAllTextAsync(
2101await File.WriteAllTextAsync(
2107await File.WriteAllTextAsync(Path.Combine(bundleDirectory, "skill-manifest.json"), "{");
2111File.Delete(Path.Combine(bundleDirectory, "skills", CommonAgentApplicators.AspireSkillName, "SKILL.md"));
2135using var stream = File.OpenRead(path);
2286await File.WriteAllBytesAsync(archivePath, ArchiveBytes, cancellationToken);
2296File.Delete(archivePath);
Agents\PlaywrightCliInstallerTests.cs (24)
196await File.WriteAllBytesAsync(tarballPath, content);
242await File.WriteAllBytesAsync(tarballPath, content);
287await File.WriteAllBytesAsync(tarballPath, content);
331await File.WriteAllBytesAsync(tarballPath, content);
380File.WriteAllBytes(tempPath, content);
471await File.WriteAllBytesAsync(tarballPath, [10, 20, 30]);
637File.WriteAllText(Path.Combine(skillDir, "SKILL.md"), "# Playwright CLI Skill");
639File.WriteAllText(Path.Combine(skillDir, "subdir", "extra.md"), "Extra content");
661Assert.True(File.Exists(Path.Combine(tempDir, ".agents", "skills", "playwright-cli", "SKILL.md")));
662Assert.True(File.Exists(Path.Combine(tempDir, ".agents", "skills", "playwright-cli", "subdir", "extra.md")));
663Assert.Equal("# Playwright CLI Skill", await File.ReadAllTextAsync(Path.Combine(tempDir, ".agents", "skills", "playwright-cli", "SKILL.md")));
666Assert.True(File.Exists(Path.Combine(tempDir, ".github", "skills", "playwright-cli", "SKILL.md")));
667Assert.True(File.Exists(Path.Combine(tempDir, ".github", "skills", "playwright-cli", "subdir", "extra.md")));
689File.WriteAllText(Path.Combine(sourceDir, "keep.md"), "keep");
693File.WriteAllText(Path.Combine(targetDir, "keep.md"), "old content");
694File.WriteAllText(Path.Combine(targetDir, "stale.md"), "should be removed");
696File.WriteAllText(Path.Combine(targetDir, "stale-dir", "old.md"), "should be removed");
701Assert.Equal("keep", File.ReadAllText(Path.Combine(targetDir, "keep.md")));
704Assert.False(File.Exists(Path.Combine(targetDir, "stale.md")));
734File.WriteAllText(Path.Combine(skillDir, "SKILL.md"), "# Playwright CLI Skill");
755Assert.True(File.Exists(Path.Combine(tempDir, ".agents", "skills", "playwright-cli", "SKILL.md")));
780await File.WriteAllTextAsync(Path.Combine(preExistingDir, "SKILL.md"), "# User's existing skill");
835File.WriteAllText(Path.Combine(skillDir, "SKILL.md"), "# Playwright CLI Skill");
1025File.WriteAllBytes(PackResult, [1, 2, 3]);
BundleNuGetServiceTests.cs (4)
23File.WriteAllText(managedPath, "old");
24File.SetLastWriteTimeUtc(managedPath, new DateTime(2026, 1, 1, 0, 0, 0, DateTimeKind.Utc));
28File.WriteAllText(managedPath, "new-content");
29File.SetLastWriteTimeUtc(managedPath, new DateTime(2026, 1, 2, 0, 0, 0, DateTimeKind.Utc));
BundleServiceComputeDefaultExtractDirTests.cs (12)
37File.WriteAllText(binaryPath, string.Empty);
38File.WriteAllText(Path.Combine(binDir, SidecarFileName), $"{{\"source\":\"{source}\"}}");
60File.WriteAllText(binaryPath, string.Empty);
61File.WriteAllText(Path.Combine(binDir, SidecarFileName), "{\"source\":\"pr\"}");
80File.WriteAllText(binaryPath, string.Empty);
81File.WriteAllText(Path.Combine(installDir, SidecarFileName), "{\"source\":\"winget\"}");
106File.WriteAllText(cellarBinary, string.Empty);
107File.WriteAllText(Path.Combine(cellarDir, SidecarFileName), "{\"source\":\"brew\"}");
112File.CreateSymbolicLink(symlinkPath, cellarBinary);
145File.WriteAllText(binaryPath, string.Empty);
146File.WriteAllText(Path.Combine(ridDir, SidecarFileName), "{\"source\":\"dotnet-tool\"}");
165File.WriteAllText(binaryPath, string.Empty);
BundleServiceIntegrationTests.cs (19)
65Assert.True(File.Exists(managedExe), $"managed exe should exist at {managedExe}");
119File.SetLastWriteTimeUtc(v2BinaryPath, File.GetLastWriteTimeUtc(v1BinaryPath).AddHours(1));
154var content = File.ReadAllText(managedExe);
223File.WriteAllText(lockedFilePath, "locked");
254File.SetLastWriteTimeUtc(v2BinaryPath, File.GetLastWriteTimeUtc(v1BinaryPath).AddHours(1));
259File.WriteAllText(Path.Combine(binDir, ".aspire-install.json"), "{\"source\":\"script\"}");
319File.WriteAllText(Path.Combine(leasesDir, "orphan.lease"), "{}");
363File.WriteAllText(Path.Combine(ridDir, ".aspire-install.json"), "{\"source\":\"dotnet-tool\"}");
379Assert.True(File.Exists(managedExe), $"managed exe should exist at {managedExe}");
444Assert.True(File.Exists(managedExe), $"managed exe should exist at {managedExe}");
493Assert.True(File.Exists(managedExe));
495var content = File.ReadAllText(managedExe);
515File.SetLastWriteTimeUtc(v2BinaryPath, File.GetLastWriteTimeUtc(v1BinaryPath).AddHours(1));
615File.WriteAllText(path, content);
634if (!Directory.Exists(managedDir) || !File.Exists(managedExe) || !Directory.Exists(dcpDir) || !File.Exists(dcpExe))
BundleServiceTests.cs (9)
78File.WriteAllText(processPath, "old");
79File.SetLastWriteTimeUtc(processPath, new DateTime(2026, 1, 1, 0, 0, 0, DateTimeKind.Utc));
83File.WriteAllText(processPath, "new-content");
84File.SetLastWriteTimeUtc(processPath, new DateTime(2026, 1, 2, 0, 0, 0, DateTimeKind.Utc));
133File.Delete(managedExe);
137File.WriteAllBytes(managedExe, []);
159File.Delete(BundleDiscovery.GetDcpExecutablePath(Path.Combine(dir, BundleDiscovery.DcpDirectoryName)));
233File.WriteAllText(
239File.WriteAllText(BundleDiscovery.GetDcpExecutablePath(dcpDir), "dcp");
Caching\AppHostInfoDiskCacheTests.cs (52)
37File.WriteAllText(path, "<Project Sdk=\"Microsoft.NET.Sdk\" />");
116using var document = JsonDocument.Parse(await File.ReadAllTextAsync(cachePath));
152File.WriteAllText(projectFile.FullName, "<Project Sdk=\"Microsoft.NET.Sdk\" />\n<!-- edit -->");
153File.SetLastWriteTimeUtc(projectFile.FullName, DateTime.UtcNow.AddSeconds(2));
172File.WriteAllText(assetsPath, "{}");
189File.WriteAllText(Path.Combine(workspace.WorkspaceRoot.FullName, "Directory.Packages.props"), "<Project />");
199File.WriteAllText(Path.Combine(workspace.WorkspaceRoot.FullName, AspireConfigFile.FileName), """
267File.WriteAllText(projectFile.FullName, "<Project Sdk=\"Microsoft.NET.Sdk\" />\n<!-- edit -->");
268File.SetLastWriteTimeUtc(projectFile.FullName, DateTime.UtcNow.AddSeconds(2));
290File.WriteAllText(projectFile.FullName, """
297File.WriteAllText(commonProps, "<Project />");
302File.WriteAllText(commonProps, """
309File.SetLastWriteTimeUtc(commonProps, DateTime.UtcNow.AddSeconds(2));
325File.WriteAllText(projectFile.FullName, """
354File.WriteAllText(projectFile.FullName, """
358File.WriteAllText(Path.Combine(workspace.WorkspaceRoot.FullName, "repo", "Directory.Build.props"), """
366File.WriteAllText(sharedProps, "<Project />");
371File.WriteAllText(sharedProps, """
378File.SetLastWriteTimeUtc(sharedProps, DateTime.UtcNow.AddSeconds(2));
391File.WriteAllText(projectFile.FullName, "<Project Sdk=\"Microsoft.NET.Sdk\" />");
392File.WriteAllText(Path.Combine(workspace.WorkspaceRoot.FullName, "repo", "Directory.Build.props"), """
400File.WriteAllText(sharedProps, "<Project />");
405File.WriteAllText(sharedProps, """
412File.SetLastWriteTimeUtc(sharedProps, DateTime.UtcNow.AddSeconds(2));
424File.WriteAllText(projectFile.FullName, "<Project Sdk=\"Microsoft.NET.Sdk\" />");
425File.WriteAllText(Path.Combine(workspace.WorkspaceRoot.FullName, "repo", "Directory.Build.props"), """
449File.WriteAllText(projectFile.FullName, """
453File.WriteAllText(Path.Combine(workspace.WorkspaceRoot.FullName, "repo", "Directory.Build.props"), """
478File.WriteAllText(projectFile.FullName, """
484File.WriteAllText(Path.Combine(workspace.WorkspaceRoot.FullName, "Aspire.Common"), "");
486File.WriteAllText(commonProps, "<Project />");
491File.WriteAllText(commonProps, """
498File.SetLastWriteTimeUtc(commonProps, DateTime.UtcNow.AddSeconds(2));
513File.WriteAllText(projectFile.FullName, """
532File.WriteAllText(projectFile.FullName, """
558File.WriteAllText(projectFile.FullName, """
562File.WriteAllText(Path.Combine(workspace.WorkspaceRoot.FullName, "Directory.Build.props"), """
567File.WriteAllText(Path.Combine(workspace.WorkspaceRoot.FullName, "repo", "Directory.Build.props"), """
594File.WriteAllText(projectFile.FullName, """
600File.WriteAllText(Path.Combine(workspace.WorkspaceRoot.FullName, "Repo.marker"), "");
602File.WriteAllText(customProps, "<Project />");
607File.WriteAllText(customProps, """
614File.SetLastWriteTimeUtc(customProps, DateTime.UtcNow.AddSeconds(2));
630File.WriteAllText(projectFile.FullName, """
654File.WriteAllText(projectFile.FullName, """
729File.WriteAllText(projectFile.FullName, "<Project Sdk=\"Microsoft.NET.Sdk\" />");
732File.WriteAllText(Path.Combine(workspace.WorkspaceRoot.FullName, "Directory.Build.props"), "<Project />");
744File.WriteAllText(parentImport, "<Project />");
747File.WriteAllText(
753File.WriteAllText(projectFile.FullName, "<Project Sdk=\"Microsoft.NET.Sdk\" />");
757File.WriteAllText(parentImport, "<Project><!-- above git boundary edit --></Project>");
758File.SetLastWriteTimeUtc(parentImport, DateTime.UtcNow.AddSeconds(2));
Commands\AddCommandTests.cs (35)
389File.WriteAllText(appHostFile.FullName, string.Empty);
390File.WriteAllText(Path.Combine(workspace.WorkspaceRoot.FullName, AspireConfigFile.FileName), """
462File.WriteAllText(appHostFile.FullName, string.Empty);
463File.WriteAllText(Path.Combine(workspace.WorkspaceRoot.FullName, AspireConfigFile.FileName), """
543File.WriteAllText(appHostFile.FullName, string.Empty);
544File.WriteAllText(Path.Combine(workspace.WorkspaceRoot.FullName, AspireConfigFile.FileName), """
642File.WriteAllText(appHostFile.FullName, string.Empty);
645File.WriteAllText(Path.Combine(workspace.WorkspaceRoot.FullName, AspireConfigFile.FileName), $$"""
726File.WriteAllText(appHostFile.FullName, string.Empty);
727File.WriteAllText(Path.Combine(projectDirectory.FullName, AspireConfigFile.FileName), """
770File.WriteAllText(appHostFile.FullName, string.Empty);
843File.WriteAllText(appHostFile.FullName, string.Empty);
844File.WriteAllText(Path.Combine(workspace.WorkspaceRoot.FullName, AspireConfigFile.FileName), """
2491File.WriteAllText(appHostFile.FullName, isTypeScript ? string.Empty : "<Project />");
2495File.WriteAllText(Path.Combine(workspace.WorkspaceRoot.FullName, AspireConfigFile.FileName), $$"""
2600File.WriteAllText(appHostFile.FullName, string.Empty);
2601File.WriteAllText(Path.Combine(workspace.WorkspaceRoot.FullName, AspireConfigFile.FileName), """
2814File.WriteAllText(Path.Combine(localPackagesDir.FullName, $"Aspire.Hosting.{cliVersion}.nupkg"), string.Empty);
2815File.WriteAllText(Path.Combine(localPackagesDir.FullName, $"Aspire.Hosting.Redis.{cliVersion}.nupkg"), string.Empty);
2852File.WriteAllText(Path.Combine(localPackagesDir.FullName, $"Aspire.Hosting.{cliVersion}.nupkg"), string.Empty);
2853File.WriteAllText(Path.Combine(localPackagesDir.FullName, $"Aspire.Hosting.Redis.{cliVersion}.nupkg"), string.Empty);
2855File.WriteAllText(Path.Combine(prPackagesDir.FullName, $"Aspire.Hosting.{staleVersion}.nupkg"), string.Empty);
2856File.WriteAllText(Path.Combine(prPackagesDir.FullName, $"Aspire.Hosting.Redis.{staleVersion}.nupkg"), string.Empty);
2882File.WriteAllText(Path.Combine(identityPackagesDir.FullName, $"Aspire.Hosting.{cliVersion}.nupkg"), string.Empty);
2883File.WriteAllText(Path.Combine(identityPackagesDir.FullName, $"Aspire.Hosting.Redis.{cliVersion}.nupkg"), string.Empty);
3011File.WriteAllText(appHostFile.FullName, string.Empty);
3061File.WriteAllText(appHostFile.FullName, string.Empty);
3111File.WriteAllText(appHostFile.FullName, string.Empty);
3165File.WriteAllText(appHostFile.FullName, string.Empty);
3213File.WriteAllText(appHostFile.FullName, string.Empty);
3261File.WriteAllText(appHostFile.FullName, string.Empty);
3309File.WriteAllText(appHostFile.FullName, string.Empty);
3361File.WriteAllText(appHostFile.FullName, string.Empty);
3412File.WriteAllText(appHostFile.FullName, string.Empty);
3470File.WriteAllText(appHostFile.FullName, string.Empty);
Commands\CacheCommandTests.cs (12)
49File.WriteAllText(Path.Combine(restoreDir.FullName, "test.dll"), "fake");
63Assert.False(File.Exists(Path.Combine(restoreDir.FullName, "test.dll")));
73await File.WriteAllTextAsync(cacheEntry, "{}").DefaultTimeout();
84Assert.False(File.Exists(cacheEntry));
105await File.WriteAllTextAsync(Path.Combine(firstBuildCache.FullName, "Aspire.Hosting.dll"), "fake").DefaultTimeout();
106await File.WriteAllTextAsync(Path.Combine(secondBuildCache.FullName, "Aspire.Hosting.dll"), "fake").DefaultTimeout();
171File.WriteAllText(Path.Combine(tempDir.FullName, "root.txt"), "root");
172File.WriteAllText(Path.Combine(subDir.FullName, "nested.txt"), "nested");
198File.WriteAllText(keepFile, "keep");
199File.WriteAllText(deleteFile, "delete");
206Assert.True(File.Exists(keepFile));
207Assert.False(File.Exists(deleteFile));
Commands\DoctorCommandTests.cs (19)
85Assert.SkipUnless(File.Exists("/etc/os-release"), "Linux /etc/os-release is required for this test.");
88await File.ReadAllTextAsync("/etc/os-release", TestContext.Current.CancellationToken));
167await File.WriteAllTextAsync(appHostFile.FullName, "<Project />");
194await File.WriteAllTextAsync(appHostFile.FullName, "export {};");
195await File.WriteAllTextAsync(
243await File.WriteAllTextAsync(appHostFile.FullName, "<Project />");
270await File.WriteAllTextAsync(projectFile.FullName, "<Project />");
298await File.WriteAllTextAsync(projectFile.FullName, "<Project />");
301await File.WriteAllTextAsync(appHostFile.FullName, "<Project />");
323await File.WriteAllTextAsync(Path.Combine(workspace.WorkspaceRoot.FullName, "AppHost.csproj"), "<Project />");
324await File.WriteAllTextAsync(Path.Combine(workspace.WorkspaceRoot.FullName, "AppHost.fsproj"), "<Project />");
351await File.WriteAllTextAsync(appHostFile.FullName, "export {};");
405await File.WriteAllTextAsync(appHostFile.FullName, "<Project />");
406await File.WriteAllTextAsync(
496await File.WriteAllTextAsync(appHostFile.FullName, "<Project />");
497await File.WriteAllTextAsync(
527await File.WriteAllTextAsync(appHostFile.FullName, "<Project />");
528await File.WriteAllTextAsync(
561await File.WriteAllTextAsync(appHostFile.FullName, "<Project />");
Commands\ExportCommandTests.cs (15)
66Assert.True(File.Exists(outputPath), "Export zip file should be created");
137Assert.True(File.Exists(outputPath), $"Export zip file should be created at the specified path: {outputPath}");
155File.WriteAllText(appHostProjectPath, "<Project />");
172Assert.False(File.Exists(outputPath), "No zip should be created when the AppHost is not running");
285Assert.True(File.Exists(outputPath), "Export zip file should be created");
347Assert.True(File.Exists(outputPath), "Export zip file should be created");
465Assert.True(File.Exists(outputPath), "Export zip file should be created");
523Assert.True(File.Exists(outputPath), "Export zip file should be created");
583Assert.True(File.Exists(outputPath), "Export zip file should be created");
633Assert.True(File.Exists(outputPath));
675Assert.True(File.Exists(outputPath));
719Assert.True(File.Exists(outputPath));
755Assert.False(File.Exists(outputPath), "No zip should be created when the resource doesn't exist");
794Assert.True(File.Exists(outputPath), "Export zip file should be created");
841Assert.True(File.Exists(outputPath), "Export zip file should be created even without dashboard");
Commands\InitCommandTests.cs (82)
67File.WriteAllText(solutionFile.FullName, "Fake solution file");
70File.WriteAllText(projectFile.FullName, "<Project />");
109Assert.False(File.Exists(Path.Combine(workspace.WorkspaceRoot.FullName, "aspire.config.json")));
118File.WriteAllText(solutionFile.FullName, "Fake solution file");
150Assert.False(File.Exists(Path.Combine(workspace.WorkspaceRoot.FullName, "aspire.config.json")));
166Assert.True(File.Exists(Path.Combine(workspace.WorkspaceRoot.FullName, "apphost.cs")));
168var config = JsonNode.Parse(File.ReadAllText(Path.Combine(workspace.WorkspaceRoot.FullName, "aspire.config.json")))!.AsObject();
194Assert.True(File.Exists(runJsonPath), "apphost.run.json should be created so `dotnet run apphost.cs` works.");
196var runJson = JsonNode.Parse(File.ReadAllText(runJsonPath))!.AsObject();
220var aspireConfig = JsonNode.Parse(File.ReadAllText(Path.Combine(workspace.WorkspaceRoot.FullName, "aspire.config.json")))!.AsObject();
263File.WriteAllText(Path.Combine(workspace.WorkspaceRoot.FullName, "aspire.config.json"), existingAspireConfig);
274var runJson = JsonNode.Parse(File.ReadAllText(Path.Combine(workspace.WorkspaceRoot.FullName, "apphost.run.json")))!.AsObject();
314File.WriteAllText(aspireConfigPath, customAspireConfig);
327var aspireConfig = JsonNode.Parse(File.ReadAllText(aspireConfigPath))!.AsObject();
338Assert.True(File.Exists(Path.Combine(workspace.WorkspaceRoot.FullName, "apphost.run.json")));
362Assert.True(File.Exists(Path.Combine(workspace.WorkspaceRoot.FullName, "apphost.cs")));
397Assert.True(File.Exists(Path.Combine(workspace.WorkspaceRoot.FullName, "apphost.mts")));
399var config = JsonNode.Parse(File.ReadAllText(Path.Combine(workspace.WorkspaceRoot.FullName, "aspire.config.json")))!.AsObject();
412File.WriteAllText(existingAppHostPath, existingAppHostContent);
413File.WriteAllText(Path.Combine(workspace.WorkspaceRoot.FullName, "package.json"), """{ "type": "commonjs" }""");
427Assert.Equal(existingAppHostContent, File.ReadAllText(existingAppHostPath));
428Assert.False(File.Exists(Path.Combine(workspace.WorkspaceRoot.FullName, "apphost.mts")));
429Assert.Equal("""{ "type": "commonjs" }""", File.ReadAllText(Path.Combine(workspace.WorkspaceRoot.FullName, "package.json")));
436File.WriteAllText(Path.Combine(workspace.WorkspaceRoot.FullName, "package.json"), "{}");
445File.WriteAllText(Path.Combine(scaffoldDirectory.FullName, context.Language.AppHostFileName!), string.Empty);
475Assert.False(File.Exists(Path.Combine(workspace.WorkspaceRoot.FullName, "apphost.mts")));
476Assert.True(File.Exists(Path.Combine(workspace.WorkspaceRoot.FullName, "aspire-apphost", "apphost.mts")));
587Assert.True(File.Exists(Path.Combine(workspace.WorkspaceRoot.FullName, "apphost.cs")));
609Assert.True(File.Exists(Path.Combine(workspace.WorkspaceRoot.FullName, "apphost.cs")));
629Assert.True(File.Exists(Path.Combine(workspace.WorkspaceRoot.FullName, "apphost.cs")));
632Assert.True(File.Exists(aspireSkillPath), $"Expected aspire skill file at {aspireSkillPath}");
654var appHostContent = await File.ReadAllTextAsync(appHostPath);
677await File.WriteAllTextAsync(configPath, existingConfig.ToJsonString());
688var merged = JsonNode.Parse(await File.ReadAllTextAsync(configPath))!.AsObject();
705await File.WriteAllTextAsync(configPath, "{ this is not json");
725await File.WriteAllTextAsync(appHostPath, preExistingContent);
735Assert.Equal(preExistingContent, await File.ReadAllTextAsync(appHostPath));
744File.WriteAllText(solutionFile.FullName, "Fake solution file");
787File.Exists(Path.Combine(workspace.WorkspaceRoot.FullName, "nuget.config")),
797File.WriteAllText(solutionFile.FullName, "Fake solution file");
874File.WriteAllText(solutionFile.FullName, "Fake solution file");
940File.WriteAllText(solutionFile.FullName, "Fake solution file");
989File.WriteAllText(solutionFile.FullName, "Fake solution file");
1058Assert.True(File.Exists(Path.Combine(workspace.WorkspaceRoot.FullName, "apphost.cs")));
1061Assert.True(File.Exists(nugetConfigPath), $"nuget.config should be created in workspace for channel '{contextChannel}'.");
1093Assert.True(File.Exists(Path.Combine(workspace.WorkspaceRoot.FullName, "apphost.cs")));
1096Assert.False(File.Exists(nugetConfigPath), "stable-identity init must not drop a nuget.config (stable packages resolve from ambient nuget.org).");
1131Assert.True(File.Exists(configPath));
1133var config = JsonNode.Parse(File.ReadAllText(configPath))!.AsObject();
1156await File.WriteAllTextAsync(configPath, existing.ToJsonString());
1172var config = JsonNode.Parse(await File.ReadAllTextAsync(configPath))!.AsObject();
1204var config = JsonNode.Parse(File.ReadAllText(configPath))!.AsObject();
1248var config = JsonNode.Parse(File.ReadAllText(configPath))!.AsObject();
1364await File.WriteAllTextAsync(configPath, existing.ToJsonString());
1470File.WriteAllText(solutionFile.FullName, "Fake solution file");
1549File.WriteAllText(solutionFile.FullName, "Fake solution file");
1637File.WriteAllText(solutionFile.FullName, "Fake solution file");
1658nugetConfigContentAtNewProjectTime = File.Exists(nugetConfigPath)
1659? File.ReadAllText(nugetConfigPath)
1676Assert.True(File.Exists(nugetConfigPath), $"nuget.config should be created in the solution directory for channel '{contextChannel}'.");
1698File.WriteAllText(solutionFile.FullName, "Fake solution file");
1727Assert.False(File.Exists(nugetConfigPath), "stable-identity init must not drop a nuget.config (stable packages resolve from ambient nuget.org).");
1745File.WriteAllText(solutionFile.FullName, "Fake solution file");
1750Assert.False(File.Exists(Path.Combine(workspace.WorkspaceRoot.FullName, "nuget.config")));
1772Assert.True(File.Exists(nugetConfigPath), "rerun must create the workspace nuget.config even though the AppHost dir already exists.");
1790File.WriteAllText(appHostPath, "#:sdk Aspire.AppHost.Sdk@13.4.0-staging.x\nbuilder.Build().Run();");
1791Assert.False(File.Exists(Path.Combine(workspace.WorkspaceRoot.FullName, "nuget.config")));
1809Assert.True(File.Exists(nugetConfigPath), "rerun must create the workspace nuget.config even though apphost.cs already exists.");
1828File.WriteAllText(solutionFile.FullName, "Fake solution file");
1857Assert.True(File.Exists(Path.Combine(solutionDir.FullName, "nuget.config")),
1859Assert.False(File.Exists(Path.Combine(workspace.WorkspaceRoot.FullName, "nuget.config")),
1878File.WriteAllText(solutionFile.FullName, "Fake solution file");
1890File.WriteAllText(nugetConfigPath, nugetConfigContent);
1920var merged = File.ReadAllText(nugetConfigPath);
1939File.WriteAllText(solutionFile.FullName, "Fake solution file");
1971var content = File.ReadAllText(nugetConfigPath);
1994File.WriteAllText(solutionFile.FullName, "Fake solution file");
2038File.Exists(Path.Combine(workspace.WorkspaceRoot.FullName, "nuget.config")),
2055File.WriteAllText(solutionFile.FullName, """<Solution />""");
2085Assert.True(File.Exists(nugetConfigPath));
2188File.WriteAllText(Path.Combine(context.TargetDirectory.FullName, appHostFileName), string.Empty);
2198File.WriteAllText(Path.Combine(context.TargetDirectory.FullName, AspireConfigFile.FileName), config.ToJsonString());
Commands\NewCommandTests.cs (63)
150Assert.True(File.Exists(nugetConfigPath));
152var nugetConfig = await File.ReadAllTextAsync(nugetConfigPath);
966File.WriteAllText(Path.Combine(context.TargetDirectory.FullName, "apphost.mts"), "// test apphost");
983Assert.True(File.Exists(Path.Combine(workspace.WorkspaceRoot.FullName, "output", "apphost.mts")));
984Assert.False(File.Exists(Path.Combine(workspace.WorkspaceRoot.FullName, "output", "aspire.config.json")));
1132File.WriteAllText(Path.Combine(context.TargetDirectory.FullName, "AppHost.java"), "package aspire;");
1157File.WriteAllText(Path.Combine(workspace.WorkspaceRoot.FullName, "aspire.config.json"), """
1195File.WriteAllText(Path.Combine(context.TargetDirectory.FullName, "AppHost.java"), "package aspire;");
1223File.WriteAllText(Path.Combine(context.TargetDirectory.FullName, "apphost.mts"), "// test apphost");
1235Assert.True(File.Exists(Path.Combine(workspace.WorkspaceRoot.FullName, "output", "apphost.mts")));
1312File.WriteAllText(Path.Combine(nestedDirectory.FullName, "Aspire.ProjectTemplates.9.2.0.nupkg"), string.Empty);
1357File.WriteAllText(Path.Combine(sourceOverride, "Aspire.ProjectTemplates.9.2.0.nupkg"), string.Empty);
1380File.WriteAllText(Path.Combine(context.TargetDirectory.FullName, scaffoldFileName), "// test apphost");
1405File.WriteAllText(Path.Combine(sourceOverride, "Aspire.ProjectTemplates.9.2.0.nupkg"), string.Empty);
1506File.WriteAllText(Path.Combine(context.TargetDirectory.FullName, "apphost.mts"), "// test apphost");
1545File.WriteAllText(Path.Combine(context.TargetDirectory.FullName, "AppHost.java"), "package aspire;");
1557Assert.True(File.Exists(Path.Combine(workspace.WorkspaceRoot.FullName, "output", "AppHost.java")));
1581File.WriteAllText(Path.Combine(context.TargetDirectory.FullName, "apphost.py"), "# test apphost");
1593Assert.True(File.Exists(Path.Combine(workspace.WorkspaceRoot.FullName, "output", "apphost.py")));
1609Assert.True(File.Exists(Path.Combine(workspace.WorkspaceRoot.FullName, "output", "apphost.cs")));
1639var appHostCreated = File.Exists(Path.Combine(workspace.WorkspaceRoot.FullName, "output", "apphost.cs"));
1668Assert.True(File.Exists(aspireConfigPath));
1669Assert.True(File.Exists(appHostRunJsonPath), "apphost.run.json must be emitted alongside aspire.config.json so dotnet run picks up matching URLs.");
1671var aspireConfig = await File.ReadAllTextAsync(aspireConfigPath);
1672var appHostRunJson = await File.ReadAllTextAsync(appHostRunJsonPath);
1702Assert.True(File.Exists(aspireConfigPath));
1703Assert.True(File.Exists(appHostRunJsonPath), "apphost.run.json must be emitted alongside aspire.config.json so dotnet run picks up matching URLs.");
1705var aspireConfig = await File.ReadAllTextAsync(aspireConfigPath);
1706var appHostRunJson = await File.ReadAllTextAsync(appHostRunJsonPath);
1776Assert.True(File.Exists(aspireConfigPath));
1777var aspireConfig = await File.ReadAllTextAsync(aspireConfigPath);
1783Assert.True(File.Exists(appHostRunJsonPath));
1784var appHostRunJson = await File.ReadAllTextAsync(appHostRunJsonPath);
1952await File.WriteAllTextAsync(Path.Combine(context.TargetDirectory.FullName, "aspire.config.json"), """
1983var configContent = await File.ReadAllTextAsync(configPath);
2047File.WriteAllText(Path.Combine(modulesDir.FullName, "aspire.mts"), "// generated sdk");
2062Assert.True(File.Exists(Path.Combine(workspace.WorkspaceRoot.FullName, "output", LanguageInfo.GeneratedFolderName, "aspire.mts")));
2136File.WriteAllText(Path.Combine(sourceOverride, "Aspire.ProjectTemplates.9.2.0.nupkg"), string.Empty);
2171File.WriteAllText(Path.Combine(modulesDir.FullName, "aspire.ts"), "// generated sdk");
2246File.WriteAllText(Path.Combine(sourceOverride, "Aspire.ProjectTemplates.9.2.0.nupkg"), string.Empty);
2368Assert.True(File.Exists(aspireSkillPath), $"Expected aspire skill file at {aspireSkillPath}");
2509Assert.True(File.Exists(skillPath));
2549Assert.False(File.Exists(skillPath));
2914File.WriteAllText(Path.Combine(context.TargetDirectory.FullName, "apphost.ts"), "// test apphost");
2930Assert.True(File.Exists(Path.Combine(expectedPath, "apphost.ts")));
2940File.WriteAllText(Path.Combine(selectedParent.FullName, "existing.txt"), "existing content");
2977File.WriteAllText(Path.Combine(context.TargetDirectory.FullName, "apphost.ts"), "// test apphost");
2994Assert.True(File.Exists(Path.Combine(expectedPath, "apphost.ts")));
3005File.WriteAllText(Path.Combine(collidingProject.FullName, "existing.txt"), "existing content");
3130File.WriteAllText(Path.Combine(context.TargetDirectory.FullName, "apphost.ts"), "// test apphost");
3147Assert.True(File.Exists(Path.Combine(expectedPath, "apphost.ts")));
3199File.WriteAllText(Path.Combine(context.TargetDirectory.FullName, "apphost.ts"), "// test apphost");
3215Assert.True(File.Exists(Path.Combine(selectedOutputPath.FullName, "apphost.ts")));
3216Assert.False(File.Exists(Path.Combine(selectedOutputPath.FullName, projectName, "apphost.ts")));
3253File.WriteAllText(Path.Combine(context.TargetDirectory.FullName, "apphost.ts"), "// test apphost");
3269Assert.True(File.Exists(Path.Combine(expectedPath, "apphost.ts")));
3295Assert.False(File.Exists(skillPath));
3321Assert.True(File.Exists(skillPath));
3323Assert.False(File.Exists(aspireifySkillPath));
3349Assert.True(File.Exists(skillPath));
3351Assert.False(File.Exists(aspireifySkillPath));
3361File.WriteAllText(Path.Combine(existingDir.FullName, "file.txt"), "content");
3410File.WriteAllText(Path.Combine(existingDir.FullName, "file.txt"), "content");
Commands\RunCommandTests.cs (43)
145Assert.True(File.Exists(socketPath), "Validation should happen before existing AppHost instances are stopped.");
158File.WriteAllText(Path.Combine(propertiesDirectory.FullName, "launchSettings.json"), """
207File.WriteAllText(Path.Combine(propertiesDirectory.FullName, "launchSettings.json"), $$"""
374await File.WriteAllTextAsync(appHostFile.FullName, "<Project />");
438await File.WriteAllTextAsync(appHostFile.FullName, "<Project />", TestContext.Current.CancellationToken);
526await File.WriteAllTextAsync(appHostFile.FullName, "<Project />", TestContext.Current.CancellationToken);
631await File.WriteAllTextAsync(appHostFile.FullName, "<Project />", TestContext.Current.CancellationToken);
787await File.WriteAllTextAsync(Path.Combine(appHost1Dir.FullName, "AppHost1.csproj"), "fake");
790await File.WriteAllTextAsync(Path.Combine(appHost2Dir.FullName, "AppHost2.csproj"), "fake");
855File.WriteAllText(projectFile.FullName, """
920await File.WriteAllTextAsync(
1088await File.WriteAllTextAsync(appHostFile.FullName, "<Project />", TestContext.Current.CancellationToken);
1161File.WriteAllText(Path.Combine(propertiesDirectory.FullName, "launchSettings.json"), """
1313await File.WriteAllTextAsync(appHostFile.FullName, "<Project />");
1389await File.WriteAllTextAsync(appHostFile.FullName, "<Project />");
1453await File.WriteAllTextAsync(appHostFile.FullName, "<Project />");
1515await File.WriteAllTextAsync(appHostFile.FullName, "<Project />");
1573await File.WriteAllTextAsync(appHostFile.FullName, "<Project />");
1635await File.WriteAllTextAsync(appHostFile.FullName, "<Project />");
1696await File.WriteAllTextAsync(appHostFile.FullName, "<Project />");
1759await File.WriteAllTextAsync(appHostFile.FullName, "<Project />");
1820await File.WriteAllTextAsync(appHostFile.FullName, "<Project />");
1882await File.WriteAllTextAsync(appHostFile.FullName, "<Project />");
2567File.WriteAllText(appHostProjectFile.FullName, "<Project></Project>");
3207await File.WriteAllTextAsync(projectFile.FullName, "<Project></Project>");
3255await File.WriteAllTextAsync(projectFile.FullName, "<Project></Project>");
3299await File.WriteAllTextAsync(projectFile.FullName, "<Project></Project>");
3347await File.WriteAllTextAsync(projectFile.FullName, "<Project></Project>");
3390await File.WriteAllTextAsync(projectFile.FullName, "<Project></Project>");
3434await File.WriteAllTextAsync(projectFile.FullName, "<Project></Project>");
3478await File.WriteAllTextAsync(projectFile.FullName, "<Project></Project>");
3621File.WriteAllText(originalSecretsPath, """{"TestSecret": "TestValue"}""");
3708if (File.Exists(originalSecretsPath))
3710File.Delete(originalSecretsPath);
3811var lines = await File.ReadAllLinesAsync(logFilePath);
3848var lines = await File.ReadAllLinesAsync(logFilePath);
3891await File.WriteAllTextAsync(appHostFile.FullName, "<Project />");
3940File.WriteAllText(appHostFile.FullName, "<Project />");
4007File.WriteAllText(appHostFile.FullName, "<Project />");
4035File.WriteAllText(appHostFile.FullName, "<Project />");
4283File.WriteAllText(appHostFile.FullName, "<Project />");
4324File.WriteAllText(appHostFile.FullName, "<Project />");
4340File.WriteAllText(socketPath, "");
Commands\StartCommandTests.cs (10)
158Assert.True(File.Exists(socketPath), "Validation should happen before existing AppHost instances are stopped.");
217File.WriteAllText(Path.Combine(propertiesDirectory.FullName, "launchSettings.json"), """
268await File.WriteAllTextAsync(Path.Combine(appHost1Dir.FullName, "AppHost1.csproj"), "fake");
271await File.WriteAllTextAsync(Path.Combine(appHost2Dir.FullName, "AppHost2.csproj"), "fake");
299await File.WriteAllTextAsync(Path.Combine(appHost1Dir.FullName, "AppHost1.csproj"), "fake");
302await File.WriteAllTextAsync(Path.Combine(appHost2Dir.FullName, "AppHost2.csproj"), "fake");
331await File.WriteAllTextAsync(appHostFile.FullName, "<Project />");
384File.WriteAllText(appHostFile.FullName, "<Project />");
668File.WriteAllText(appHostFile.FullName, "<Project />");
684File.WriteAllText(socketPath, "");
Commands\StopCommandTests.cs (27)
270Assert.False(File.Exists(primaryConnection.SocketPath));
271Assert.True(File.Exists(nestedConnection.SocketPath));
281await File.WriteAllTextAsync(appHostFile.FullName, "<Project />");
348Assert.True(File.Exists(connection.SocketPath));
388Assert.False(File.Exists(connection.SocketPath));
475await File.WriteAllTextAsync(appHostFile.FullName, "<Project />");
509await File.WriteAllTextAsync(appHostFile.FullName, "<Project />");
541await File.WriteAllTextAsync(runningAppHostFile.FullName, "<Project />");
544await File.WriteAllTextAsync(discoveredAppHostFile.FullName, "<Project />");
593await File.WriteAllTextAsync(appHostFile.FullName, "<Project />");
625await File.WriteAllTextAsync(appHostFile.FullName, "<Project />");
660await File.WriteAllTextAsync(appHostFile.FullName, "<Project />");
700await File.WriteAllTextAsync(appHostFile.FullName, "<Project />");
735await File.WriteAllTextAsync(appHostFile.FullName, "<Project />");
775await File.WriteAllTextAsync(appHostFile.FullName, "<Project />");
815await File.WriteAllTextAsync(appHostFile.FullName, "<Project />");
854await File.WriteAllTextAsync(appHostFile.FullName, "");
900await File.WriteAllTextAsync(appHostFile.FullName, "<Project />");
937await File.WriteAllTextAsync(appHostFile.FullName, "<Project />");
982await File.WriteAllTextAsync(appHostFile.FullName, "<Project />");
1020await File.WriteAllTextAsync(appHostFile.FullName, "<Project />");
1058await File.WriteAllTextAsync(appHostFile.FullName, "<Project />");
1126await File.WriteAllTextAsync(appHostFile.FullName, "<Project />");
1192Assert.True(File.Exists(socketPath));
1213Assert.False(File.Exists(socketPath));
1228File.WriteAllText(BundleDiscovery.GetDcpExecutablePath(dcpDirectory.FullName), "");
1309File.WriteAllText(socketPath, "");
Commands\UpdateCommandTests.cs (57)
89await File.WriteAllTextAsync(appHostProjectFile.FullName, """
192File.WriteAllText(oldBackup1, "test");
193File.WriteAllText(oldBackup2, "test");
194File.WriteAllText(otherFile, "test");
200Assert.False(File.Exists(oldBackup1), "Old backup file should be deleted");
201Assert.False(File.Exists(oldBackup2), "Old backup file should be deleted");
202Assert.True(File.Exists(otherFile), "Other files should not be deleted");
213File.WriteAllText(oldBackup, "test");
223Assert.True(File.Exists(oldBackup), "Locked file should still exist on Windows");
227Assert.False(File.Exists(oldBackup), "Locked file should be deleted on Mac/Linux");
377File.WriteAllText(appHostPath, "// test apphost");
440File.WriteAllText(appHostPath, "// test apphost");
495File.WriteAllText(appHostPath, "// test apphost");
1265File.WriteAllText(appHostPath, "// test apphost");
1467File.WriteAllText(archivePath, "fake archive");
1493await File.WriteAllTextAsync(processPath, "#!/bin/sh\nexit 0\n");
1497await File.WriteAllTextAsync(
1518using var document = JsonDocument.Parse(await File.ReadAllBytesAsync(sidecarPath));
1536await File.WriteAllTextAsync(processPath, originalExecutable);
1541await File.WriteAllTextAsync(sidecarPath, originalSidecar);
1562Assert.Equal(originalExecutable, await File.ReadAllTextAsync(processPath));
1563Assert.Equal(originalSidecar, await File.ReadAllTextAsync(sidecarPath));
1592File.WriteAllText(archivePath, "fake archive");
1633File.WriteAllText(archivePath, "fake archive");
2032File.WriteAllText(localConfigPath, """{ "channel": "staging" }""");
2053File.WriteAllText(globalSettingsPath, """{ "channel": "staging" }""");
2071File.WriteAllText(localConfigPath, """{ "channel": "staging" }""");
2090File.WriteAllText(Path.Combine(globalDir, "settings.global.json"), """{ "channel": "daily" }""");
2093File.WriteAllText(localConfigPath, """{ "channel": "staging" }""");
2114File.WriteAllText(Path.Combine(globalDir, "settings.global.json"), """{ "channel": "staging" }""");
2134File.WriteAllText(localConfigPath, """{ "channel": "no-such-channel" }""");
2250File.WriteAllText(projectConfigPath, """{ "channel": "staging" }""");
2267File.WriteAllText(
2273File.WriteAllText(Path.Combine(globalDir, "settings.global.json"), """{ "channel": "staging" }""");
2295File.WriteAllText(
2300File.WriteAllText(
2321File.WriteAllText(
2327File.WriteAllText(Path.Combine(globalDir, "settings.global.json"), """{ "channel": "staging" }""");
2330File.WriteAllText(
2378File.WriteAllText(
2631File.WriteAllText(appHostFile.FullName, string.Empty);
2632File.WriteAllText(
2775File.WriteAllText(
2960File.WriteAllText(archivePath, "fake archive");
3005File.WriteAllText(archivePath, "fake archive");
3050File.WriteAllText(archivePath, "fake archive");
3083File.WriteAllText(archivePath, "fake archive");
3270File.WriteAllText(archivePath, "fake archive");
3295await File.WriteAllTextAsync(
3313await using var tarStream = File.OpenRead(tarPath);
3314await using var archiveStream = File.Create(archivePath);
3330File.SetUnixFileMode(
3354File.WriteAllText(processPath, string.Empty);
3355File.WriteAllText(storeExecutablePath, string.Empty);
3366File.WriteAllText(processPath, string.Empty);
3367File.WriteAllText(Path.Combine(binaryDir, InstallSidecarReader.SidecarFileName), """{"source":"nix"}""");
3436File.WriteAllText(archivePath, "fake archive");
Configuration\AspireConfigFileTests.cs (28)
27File.WriteAllText(configPath, """
47File.WriteAllText(configPath, """
71File.WriteAllText(configPath, """
95File.WriteAllText(configPath, """
118File.WriteAllText(configPath, """
137File.WriteAllText(configPath, "{ invalid json content }");
151File.WriteAllText(configPath, """{ "appHost": { "path": """);
164File.WriteAllText(configPath, "{}");
187Assert.True(File.Exists(filePath));
189var content = File.ReadAllText(filePath);
204Assert.True(File.Exists(Path.Combine(subDir, AspireConfigFile.FileName)));
220File.WriteAllText(Path.Combine(workspace.WorkspaceRoot.FullName, AspireConfigFile.FileName), "{}");
362File.WriteAllText(configPath, """
383File.WriteAllText(configPath, """
458File.WriteAllText(settingsPath, """
480File.WriteAllText(settingsPath, """
503File.WriteAllText(settingsPath, """
521File.WriteAllText(settingsPath, """
532Assert.True(File.Exists(configPath));
548File.WriteAllText(settingsPath, $$"""
569File.WriteAllText(settingsPath, """
589File.WriteAllText(settingsPath, """
609File.WriteAllText(settingsPath, """
629File.WriteAllText(settingsPath, """
650File.WriteAllText(settingsPath, """
670File.WriteAllText(settingsPath, """
688File.WriteAllText(settingsPath, """
708File.WriteAllText(settingsPath, $$"""
Configuration\ConfigurationHelperTests.cs (12)
18File.WriteAllText(settingsPath, content);
120File.WriteAllText(settingsPath, """
131var json = JsonNode.Parse(File.ReadAllText(settingsPath));
151File.WriteAllText(Path.Combine(configRoot.FullName, AspireConfigFile.FileName), "{}");
192File.WriteAllText(legacySettingsPath, """
200Assert.False(File.Exists(aspireConfigPath), "Precondition: aspire.config.json should not yet exist.");
209File.Exists(aspireConfigPath),
236File.WriteAllText(aspireConfigPath, existingContent);
240File.WriteAllText(legacySettingsPath, """
250Assert.Equal(existingContent, File.ReadAllText(aspireConfigPath));
264File.WriteAllText(legacySettingsPath, "{ this is not valid json");
277Assert.False(File.Exists(migratedPath), "Unparseable legacy file must not produce an aspire.config.json on disk.");
DotNet\DotNetCliRunnerTests.cs (70)
46await File.WriteAllTextAsync(projectFile.FullName, "Not a real project file.");
95await File.WriteAllTextAsync(appHostFile.FullName, "Not a real AppHost.");
134await File.WriteAllTextAsync(projectFile.FullName, "Not a real project file.");
170await File.WriteAllTextAsync(projectFile.FullName, "Not a real project file.");
212await File.WriteAllTextAsync(projectFile.FullName, "Not a real project file.");
251await File.WriteAllTextAsync(projectFile.FullName, "Not a real project file.");
279await File.WriteAllTextAsync(projectFile.FullName, "Not a real project file.");
313File.WriteAllText(cliPath, string.Empty);
314File.WriteAllText(Path.Combine(cliDirectory.FullName, "aspire.dll"), string.Empty);
326File.WriteAllText(cliPath, string.Empty);
327File.WriteAllText(Path.Combine(cliDirectory.FullName, "aspire.dll"), string.Empty);
331File.CreateSymbolicLink(linkPath, cliPath);
342File.WriteAllText(dotnetPath, string.Empty);
353File.WriteAllText(cliPath, string.Empty);
354File.WriteAllText(Path.Combine(cliDirectory.FullName, "aspire.dll"), string.Empty);
355File.WriteAllText(Path.Combine(cliDirectory.FullName, ".aspire-install.json"), """{"source":"script"}""");
366File.WriteAllText(cliPath, string.Empty);
367File.WriteAllText(Path.Combine(cliDirectory.FullName, "aspire.dll"), string.Empty);
370File.WriteAllText(Path.Combine(cliDirectory.FullName, "dcp", OperatingSystem.IsWindows() ? "dcp.exe" : "dcp"), string.Empty);
371File.WriteAllText(Path.Combine(cliDirectory.FullName, "managed", OperatingSystem.IsWindows() ? "aspire-managed.exe" : "aspire-managed"), string.Empty);
381await File.WriteAllTextAsync(projectFile.FullName, "Not a real project file.");
409await File.WriteAllTextAsync(projectFile.FullName, "Not a real project file.");
446await File.WriteAllTextAsync(projectFile.FullName, "Not a real project file.");
475await File.WriteAllTextAsync(projectFile.FullName, "Not a real project file.");
504await File.WriteAllTextAsync(projectFile.FullName, "Not a real project file.");
577await File.WriteAllTextAsync(projectFile.FullName, "Not a real project file.");
614await File.WriteAllTextAsync(projectFile.FullName, "Not a real project file.");
655await File.WriteAllTextAsync(projectFile.FullName, "Not a real project file.");
700await File.WriteAllTextAsync(projectFile.FullName, "Not a real project file.");
755await File.WriteAllTextAsync(projectFile.FullName, "Not a real project file.");
852await File.WriteAllTextAsync(projectFile.FullName, "Not a real project file.");
892await File.WriteAllTextAsync(projectFile.FullName, "Not a real project file.");
934await File.WriteAllTextAsync(projectFile.FullName, "Not a real project file.");
981await File.WriteAllTextAsync(projectFile.FullName, "Not a real project file.");
1044await File.WriteAllTextAsync(projectFile.FullName, "Not a real project file.");
1090await File.WriteAllTextAsync(projectFile.FullName, "Not a real project file.");
1132await File.WriteAllTextAsync(projectFile.FullName, "Not a real project file.");
1174await File.WriteAllTextAsync(appHostFile.FullName, "// Single-file AppHost");
1227await File.WriteAllTextAsync(projectFile.FullName, "<Project></Project>");
1294await File.WriteAllTextAsync(projectFile.FullName, "<Project></Project>");
1360await File.WriteAllTextAsync(projectFile.FullName, "<Project></Project>");
1433await File.WriteAllTextAsync(solutionFile.FullName, "Not a real solution file.");
1438await File.WriteAllTextAsync(project1File.FullName, "Not a real project file.");
1442await File.WriteAllTextAsync(project2File.FullName, "Not a real project file.");
1480await File.WriteAllTextAsync(projectFile.FullName, "Not a real project file.");
1483await File.WriteAllTextAsync(referencedProject.FullName, "Not a real project file.");
1513await File.WriteAllTextAsync(appHostFile.FullName, "// Single-file AppHost");
1560await File.WriteAllTextAsync(appHostFile.FullName, "// Single-file AppHost");
1606await File.WriteAllTextAsync(projectFile.FullName, "Not a real project file.");
1643await File.WriteAllTextAsync(appHostFile.FullName, "// Single-file AppHost");
1680await File.WriteAllTextAsync(appHostFile.FullName, "// Single-file AppHost");
1721await File.WriteAllTextAsync(projectFile.FullName, "Not a real project file.");
1766await File.WriteAllTextAsync(appHostFile.FullName, "// Single-file AppHost");
1818await File.WriteAllTextAsync(projectFile.FullName, "Not a real project file.");
1867await File.WriteAllTextAsync(projectFile.FullName, "Not a real project file.");
1915await File.WriteAllTextAsync(appHostFile.FullName, "// Single-file AppHost");
1952await File.WriteAllTextAsync(projectFile.FullName, "Not a real project file.");
1987await File.WriteAllTextAsync(projectFile.FullName, "Not a real project file.");
2030await File.WriteAllTextAsync(projectFile.FullName, "Not a real project file.");
2072await File.WriteAllTextAsync(projectFile.FullName, "Not a real project file.");
2112await File.WriteAllTextAsync(projectFile.FullName, "Not a real project file.");
2152await File.WriteAllTextAsync(projectFile.FullName, """
2162await File.WriteAllTextAsync(Path.Combine(projectDirectory.FullName, "Program.cs"), "Console.WriteLine(\"Hello\");");
2197await File.WriteAllTextAsync(projectFile.FullName, "Not a real project file.");
2418await File.WriteAllTextAsync(packagePath, string.Empty);
2488await File.WriteAllTextAsync(projectFile.FullName, "Not a real project file.");
2526await File.WriteAllTextAsync(projectFile.FullName, "Not a real project file.");
2564await File.WriteAllTextAsync(projectFile.FullName, "Not a real project file.");
2604await File.WriteAllTextAsync(projectFile.FullName, "Not a real project file.");
2643await File.WriteAllTextAsync(projectFile.FullName, "Not a real project file.");
DotNet\ProcessExecutionDetachedTests.cs (18)
55await File.WriteAllTextAsync(dcpPath, """
87File.SetUnixFileMode(dcpPath, UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute);
115], await File.ReadAllLinesAsync(capturePath));
137await File.WriteAllTextAsync(dcpPath, """
155File.SetUnixFileMode(dcpPath, UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute);
218await File.WriteAllTextAsync(dcpPath, """
235File.SetUnixFileMode(dcpPath, UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute);
257await File.WriteAllTextAsync(dcpPath, """
277File.SetUnixFileMode(dcpPath, UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute);
291var childPid = int.Parse(await File.ReadAllTextAsync(capturePath), CultureInfo.InvariantCulture);
311await File.WriteAllTextAsync(dcpPath, """
328File.SetUnixFileMode(dcpPath, UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute);
352Assert.Equal(Path.GetFullPath(versionDirectory.FullName), (await File.ReadAllTextAsync(capturePath)).Trim());
366await File.WriteAllTextAsync(dcpPath, """
382File.SetUnixFileMode(dcpPath, UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute);
416await File.WriteAllTextAsync(dcpPath, """
432File.SetUnixFileMode(dcpPath, UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute);
474while (!File.Exists(path))
Migrations\TypeScriptAppHostMigrationTests.cs (21)
55await File.WriteAllTextAsync(appHostPath, "import { createBuilder } from './.modules/aspire.js';");
70await File.WriteAllTextAsync(
83await File.WriteAllTextAsync(Path.Combine(workspace.WorkspaceRoot.FullName, "apphost.ts"), "// legacy");
84await File.WriteAllTextAsync(Path.Combine(workspace.WorkspaceRoot.FullName, "apphost.mts"), "// modern");
95await File.WriteAllTextAsync(Path.Combine(workspace.WorkspaceRoot.FullName, "apphost.cs"), "// csharp");
152await File.WriteAllTextAsync(Path.Combine(root.FullName, "apphost.ts"), LegacyAppHostContent);
153await File.WriteAllTextAsync(
162await File.WriteAllTextAsync(
170await File.WriteAllTextAsync(
181await File.WriteAllTextAsync(Path.Combine(root.FullName, "eslint.config.mjs"), LegacyEslintConfigContent);
184await File.WriteAllTextAsync(Path.Combine(modulesDir.FullName, "aspire.ts"), "// generated");
189var config = JsonNode.Parse(await File.ReadAllTextAsync(Path.Combine(root.FullName, "aspire.config.json")))!;
192var tsconfig = JsonNode.Parse(await File.ReadAllTextAsync(Path.Combine(root.FullName, "tsconfig.apphost.json")))!;
196var packageJson = JsonNode.Parse(await File.ReadAllTextAsync(Path.Combine(root.FullName, "package.json")))!;
201var eslintConfig = await File.ReadAllTextAsync(Path.Combine(root.FullName, "eslint.config.mjs"));
214Assert.False(File.Exists(Path.Combine(root.FullName, "apphost.ts")));
217var modernContent = await File.ReadAllTextAsync(Path.Combine(root.FullName, "apphost.mts"));
234Assert.False(File.Exists(Path.Combine(appHostDirectory.FullName, "apphost.ts")));
236Assert.Equal(ExpectedModernAppHostContent, await File.ReadAllTextAsync(Path.Combine(appHostDirectory.FullName, "apphost.mts")));
278var migratedContent = await File.ReadAllTextAsync(Path.Combine(root.FullName, "apphost.mts"));
282Assert.Equal(migratedContent, await File.ReadAllTextAsync(Path.Combine(root.FullName, "apphost.mts")));
Npm\AspireJsLauncherTests.cs (15)
44File.WriteAllText(layout.RidPackageJsonPath, "{ not valid json");
67File.WriteAllText(monkeyPatchScript, """
96File.WriteAllText(monkeyPatchScript, """
139Assert.True(File.Exists(cachedBinaryPath), $"Expected cached binary at {cachedBinaryPath}");
151File.WriteAllText(probeScript, $$"""
173File.WriteAllText(probeScript, $$"""
186var scriptContent = File.ReadAllText(scriptPath);
245File.WriteAllText(
252File.Copy(realLauncherPath, launcherScript);
256File.WriteAllText(
266File.WriteAllText(
275File.WriteAllText(probeScript, """
292File.Copy(GetNodeExecutablePath(), binaryPath);
300File.WriteAllText(binaryPath, """
408while (current is not null && !File.Exists(Path.Combine(current, "Aspire.slnx")))
NuGet\BundleNuGetServiceTests.cs (16)
27File.WriteAllText(managedPath, string.Empty);
68File.WriteAllText(managedPath, string.Empty);
102File.WriteAllText(managedPath, string.Empty);
105File.WriteAllText(nugetConfigPath, "<configuration />");
139File.WriteAllText(managedPath, string.Empty);
151File.WriteAllText(manifestPath, "{}");
183File.WriteAllText(managedPath, string.Empty);
195File.WriteAllText(manifestPath, "{ invalid json");
205File.WriteAllText(manifestPath, """{"managedAssemblies":[],"nativeLibraries":[]}""");
236File.WriteAllText(managedPath, "v1");
250File.WriteAllText(managedPath, "v2-changed");
271File.WriteAllText(managedPath, string.Empty);
315File.WriteAllText(managedPath, string.Empty);
343await File.WriteAllTextAsync(
386File.WriteAllText(managedPath, string.Empty);
394File.WriteAllText(lockedFilePath, "legacy");
Packaging\PackageChannelTests.cs (35)
146File.WriteAllText(
178File.WriteAllText(Path.Combine(packagesDirectory.FullName, "Aspire.ProjectTemplates.13.5.0.nupkg"), string.Empty);
182File.WriteAllText(Path.Combine(packagesDirectory.FullName, $"Aspire.ProjectTemplates.{pinnedVersion}.nupkg"), string.Empty);
225File.WriteAllText(Path.Combine(packagesDirectory.FullName, "Aspire.ProjectTemplates.13.5.0.nupkg"), string.Empty);
228File.WriteAllText(Path.Combine(packagesDirectory.FullName, $"Aspire.ProjectTemplates.{pinnedVersion}.nupkg"), string.Empty);
266File.WriteAllText(Path.Combine(channelPackagesDirectory.FullName, "Aspire.ProjectTemplates.13.4.0-preview.1.nupkg"), string.Empty);
270File.WriteAllText(Path.Combine(nestedDirectory.FullName, "Aspire.ProjectTemplates.13.5.0-preview.2.nupkg"), string.Empty);
305File.WriteAllText(Path.Combine(nestedDirectory.FullName, "Aspire.ProjectTemplates.13.5.0-preview.2.nupkg"), string.Empty);
332File.WriteAllText(Path.Combine(packagesDirectory.FullName, $"Aspire.Hosting.Redis.{pinnedVersion}.nupkg"), string.Empty);
333File.WriteAllText(Path.Combine(packagesDirectory.FullName, $"Aspire.Hosting.PostgreSQL.{pinnedVersion}.nupkg"), string.Empty);
334File.WriteAllText(Path.Combine(packagesDirectory.FullName, $"CommunityToolkit.Aspire.Hosting.NodeJS.{pinnedVersion}.nupkg"), string.Empty);
337File.WriteAllText(Path.Combine(packagesDirectory.FullName, "Aspire.Hosting.SqlServer.13.3.0.nupkg"), string.Empty);
340File.WriteAllText(Path.Combine(packagesDirectory.FullName, $"Aspire.ProjectTemplates.{pinnedVersion}.nupkg"), string.Empty);
347File.WriteAllText(Path.Combine(packagesDirectory.FullName, $"Aspire.Hosting.AppHost.{pinnedVersion}.nupkg"), string.Empty);
348File.WriteAllText(Path.Combine(packagesDirectory.FullName, $"Aspire.Hosting.Sdk.{pinnedVersion}.nupkg"), string.Empty);
349File.WriteAllText(Path.Combine(packagesDirectory.FullName, $"Aspire.Hosting.Orchestration.linux-arm64.{pinnedVersion}.nupkg"), string.Empty);
350File.WriteAllText(Path.Combine(packagesDirectory.FullName, $"Aspire.Hosting.Testing.{pinnedVersion}.nupkg"), string.Empty);
351File.WriteAllText(Path.Combine(packagesDirectory.FullName, $"Aspire.Hosting.Msi.{pinnedVersion}.nupkg"), string.Empty);
352File.WriteAllText(Path.Combine(packagesDirectory.FullName, $"Aspire.Hosting.Integration.Analyzers.{pinnedVersion}.nupkg"), string.Empty);
355File.WriteAllText(Path.Combine(packagesDirectory.FullName, $"Aspire.Hosting.Dapr.{pinnedVersion}.nupkg"), string.Empty);
356File.WriteAllText(Path.Combine(packagesDirectory.FullName, $"Aspire.Hosting.GitHub.Models.{pinnedVersion}.nupkg"), string.Empty);
357File.WriteAllText(Path.Combine(packagesDirectory.FullName, $"Aspire.Hosting.NodeJs.{pinnedVersion}.nupkg"), string.Empty);
640File.WriteAllText(Path.Combine(packagesDirectory.FullName, "Aspire.Hosting.Redis.13.4.0.nupkg"), string.Empty);
641File.WriteAllText(Path.Combine(packagesDirectory.FullName, "Aspire.Hosting.Redis.13.5.0-preview.1.nupkg"), string.Empty);
642File.WriteAllText(Path.Combine(packagesDirectory.FullName, "Aspire.Hosting.PostgreSQL.13.4.0-preview.1.nupkg"), string.Empty);
659File.WriteAllText(Path.Combine(packagesDirectory.FullName, "Aspire.Hosting.Redis.13.4.0.nupkg"), string.Empty);
660File.WriteAllText(Path.Combine(packagesDirectory.FullName, "Aspire.Hosting.Redis.13.5.0-preview.1.nupkg"), string.Empty);
661File.WriteAllText(Path.Combine(packagesDirectory.FullName, "Aspire.Hosting.PostgreSQL.13.4.0.nupkg"), string.Empty);
678File.WriteAllText(Path.Combine(packagesDirectory.FullName, "Aspire.Hosting.Redis.13.5.0.nupkg"), string.Empty);
679File.WriteAllText(Path.Combine(packagesDirectory.FullName, "Aspire.Hosting.Redis.13.6.0-preview.1.nupkg"), string.Empty);
680File.WriteAllText(Path.Combine(packagesDirectory.FullName, "Aspire.Hosting.Azure.Kubernetes.13.6.0-pr.19404.gf51e8e1d.nupkg"), string.Empty);
709File.WriteAllText(Path.Combine(packagesDirectory.FullName, "Aspire.Hosting.Dapr.13.4.0.nupkg"), string.Empty);
710File.WriteAllText(Path.Combine(packagesDirectory.FullName, "Aspire.Hosting.Sql.13.4.0.nupkg"), string.Empty);
729File.WriteAllText(Path.Combine(packagesDirectory.FullName, "Aspire.Hosting.Dapr.13.4.0.nupkg"), string.Empty);
730File.WriteAllText(Path.Combine(packagesDirectory.FullName, "Aspire.Hosting.Sql.13.4.0.nupkg"), string.Empty);
Packaging\PackagingServiceTests.cs (37)
1122Assert.True(File.Exists(nugetConfigPath));
1124var configContent = await File.ReadAllTextAsync(nugetConfigPath);
1377Assert.True(File.Exists(nugetConfigPath));
1379var configContent = await File.ReadAllTextAsync(nugetConfigPath);
1492File.WriteAllText(Path.Combine(localPackagesDir.FullName, $"Aspire.ProjectTemplates.{localVersion}.nupkg"), string.Empty);
1493File.WriteAllText(Path.Combine(localPackagesDir.FullName, $"Aspire.Hosting.{localVersion}.nupkg"), string.Empty);
1516File.WriteAllText(processPath, string.Empty);
1519File.WriteAllText(Path.Combine(packagesDirectory.FullName, $"Aspire.ProjectTemplates.{prVersion}.nupkg"), string.Empty);
1558File.WriteAllText(Path.Combine(defaultPackagesDirectory.FullName, $"Aspire.ProjectTemplates.{defaultHiveVersion}.nupkg"), string.Empty);
1563File.WriteAllText(processPath, string.Empty);
1566File.WriteAllText(Path.Combine(dogfoodPackagesDirectory.FullName, $"Aspire.ProjectTemplates.{dogfoodHiveVersion}.nupkg"), string.Empty);
1599File.WriteAllText(processPath, string.Empty);
1602File.WriteAllText(Path.Combine(packagesDirectory.FullName, "Aspire.ProjectTemplates.not-a-semver.nupkg"), string.Empty);
1635File.WriteAllText(processPath, string.Empty);
1665File.WriteAllText(processPath, string.Empty);
1721File.WriteAllText(processPath, string.Empty);
1757File.WriteAllText(processPath, string.Empty);
1780File.WriteAllText(Path.Combine(localPackagesDir.FullName, $"Aspire.ProjectTemplates.{localVersion}.nupkg"), string.Empty);
1972File.WriteAllText(Path.Combine(localPackagesDir.FullName, $"Aspire.ProjectTemplates.{pinnedVersion}.nupkg"), string.Empty);
2005File.WriteAllText(Path.Combine(runPackagesDir.FullName, $"Aspire.ProjectTemplates.{pinnedVersion}.nupkg"), string.Empty);
2040File.WriteAllText(Path.Combine(localPackagesDir.FullName, $"Aspire.Hosting.{localVersion}.nupkg"), string.Empty);
2042File.WriteAllText(Path.Combine(localPackagesDir.FullName, $"Aspire.Hosting.Redis.{localVersion}.nupkg"), string.Empty);
2043File.WriteAllText(Path.Combine(localPackagesDir.FullName, $"Aspire.Hosting.JavaScript.{localVersion}.nupkg"), string.Empty);
2045File.WriteAllText(Path.Combine(localPackagesDir.FullName, $"Aspire.ProjectTemplates.{localVersion}.nupkg"), string.Empty);
2046File.WriteAllText(Path.Combine(localPackagesDir.FullName, $"Aspire.AppHost.Sdk.{localVersion}.nupkg"), string.Empty);
2077File.WriteAllText(Path.Combine(localPackagesDir.FullName, "Aspire.Hosting.13.4.0-pr.16820.g1a99aa46.nupkg"), string.Empty);
2169File.WriteAllText(Path.Combine(packagesOverrideDir.FullName, $"Aspire.ProjectTemplates.{overrideVersion}.nupkg"), string.Empty);
2170File.WriteAllText(Path.Combine(packagesOverrideDir.FullName, $"Aspire.Hosting.{overrideVersion}.nupkg"), string.Empty);
2197File.WriteAllText(Path.Combine(staleHiveDir.FullName, "Aspire.Hosting.13.4.0.nupkg"), string.Empty);
2201File.WriteAllText(Path.Combine(packagesOverrideDir.FullName, $"Aspire.Hosting.{overrideVersion}.nupkg"), string.Empty);
2227File.WriteAllText(Path.Combine(packagesOverrideDir.FullName, "Aspire.Hosting.13.4.1.nupkg"), string.Empty);
2228File.WriteAllText(Path.Combine(packagesOverrideDir.FullName, "Aspire.Hosting.13.4.2.nupkg"), string.Empty);
2230File.WriteAllText(Path.Combine(packagesOverrideDir.FullName, "Aspire.ProjectTemplates.13.4.2.nupkg"), string.Empty);
2255File.WriteAllText(Path.Combine(packagesOverrideDir.FullName, "Aspire.Hosting.13.4.1.nupkg"), string.Empty);
2257File.WriteAllText(Path.Combine(nestedDir.FullName, "Aspire.Hosting.13.4.2.nupkg"), string.Empty);
2259File.WriteAllText(Path.Combine(nestedDir.FullName, "Aspire.ProjectTemplates.13.4.2.nupkg"), string.Empty);
2260File.WriteAllText(Path.Combine(packagesOverrideDir.FullName, "Aspire.ProjectTemplates.13.4.2.nupkg"), string.Empty);
Projects\DotNetAppHostProjectTests.cs (40)
266File.WriteAllText(Path.Combine(appHostFile.DirectoryName!, "apphost.run.json"), """
395Assert.False(File.Exists(socketPath));
412Assert.True(File.Exists(socketPath));
483File.WriteAllText(BundleDiscovery.GetDcpExecutablePath(customDcpDirectory.FullName), "");
487File.WriteAllText(customDashboardPath, "");
536File.WriteAllText(BundleDiscovery.GetDcpExecutablePath(inheritedDcpDirectory), "");
538File.WriteAllText(inheritedDashboardPath, "");
698File.Delete(BundleDiscovery.GetDcpExecutablePath(layout.GetDcpPath()!));
699File.Delete(layout.GetManagedPath()!);
871File.WriteAllText(repoLocalManaged, "fake");
986File.WriteAllText(Path.Combine(appHostFile.DirectoryName!, "Properties", "launchSettings.json"), """
1081File.WriteAllText(Path.Combine(appHostFile.DirectoryName!, "Properties", "launchSettings.json"), """
1165File.WriteAllText(Path.Combine(appHostFile.DirectoryName!, "Properties", "launchSettings.json"), """
1251File.WriteAllText(Path.Combine(appHostFile.DirectoryName!, "Properties", "launchSettings.json"), """
1293File.WriteAllText(Path.Combine(appHostFile.DirectoryName!, "Properties", "launchSettings.json"), """
1337File.WriteAllText(Path.Combine(appHostFile.DirectoryName!, "Properties", "launchSettings.json"), $$"""
1384File.WriteAllText(Path.Combine(appHostFile.DirectoryName!, "Properties", "launchSettings.json"), """
1429File.WriteAllText(Path.Combine(appHostFile.DirectoryName!, "Properties", "launchSettings.json"), """
1549File.WriteAllText(targetPath, string.Empty);
1633File.WriteAllText(Path.Combine(appHostFile.DirectoryName!, "Properties", "launchSettings.json"), """
1700File.WriteAllText(Path.Combine(appHostFile.DirectoryName!, "Properties", "launchSettings.json"), $$"""
1803File.WriteAllText(Path.Combine(appHostFile.DirectoryName!, "AppHost.run.json"), """
1869File.WriteAllText(Path.Combine(appHostFile.DirectoryName!, "My Project", "launchSettings.json"), """
1930File.WriteAllText(Path.Combine(appHostFile.DirectoryName!, "Properties", "launchSettings.json"), """
1995File.WriteAllText(Path.Combine(appHostFile.DirectoryName!, "Properties", "launchSettings.json"), """
2052File.WriteAllText(Path.Combine(appHostFile.DirectoryName!, "Properties", "launchSettings.json"), """
2176File.WriteAllText(Path.Combine(appHostFile.DirectoryName!, "apphost.run.json"), """
2378File.WriteAllText(Path.Combine(appHostFile.DirectoryName!, "apphost.run.json"), """
2534File.WriteAllText(appHostPath, """
2556File.WriteAllText(socketPath, "");
2564File.WriteAllText(targetPath, string.Empty);
2565File.WriteAllText(Path.ChangeExtension(targetPath, ".runtimeconfig.json"), "{}");
2573File.WriteAllText(commandPath, string.Empty);
4155while (dir is not null && !File.Exists(Path.Combine(dir.FullName, "Aspire.slnx")))
4179File.WriteAllText(path, content);
4209File.WriteAllText(appHostPath, """
4226File.WriteAllText(projectPath, """
4242File.WriteAllText(BundleDiscovery.GetDcpExecutablePath(dcpDirectory.FullName), "");
4243File.WriteAllText(
4299=> File.WriteAllText(Path.Combine(directory, "aspire.config.json"), content);
Projects\FallbackProjectParserTests.cs (14)
31await File.WriteAllTextAsync(projectFile, projectContent);
56await File.WriteAllTextAsync(projectFile, projectContent);
81await File.WriteAllTextAsync(projectFile, projectContent);
106await File.WriteAllTextAsync(projectFile, projectContent);
132await File.WriteAllTextAsync(projectFile, projectContent);
158await File.WriteAllTextAsync(projectFile, projectContent);
195await File.WriteAllTextAsync(projectFile, invalidProjectContent);
217await File.WriteAllTextAsync(projectFile, projectContent);
247await File.WriteAllTextAsync(projectFile, projectContent);
270await File.WriteAllTextAsync(projectFile, projectContent);
294await File.WriteAllTextAsync(projectFile, projectContent);
317await File.WriteAllTextAsync(projectFile, projectContent);
339await File.WriteAllTextAsync(projectFile, projectContent);
357await File.WriteAllTextAsync(projectFile, projectContent);
Projects\GuestAppHostProjectTests.cs (60)
55await File.WriteAllTextAsync(kept, "class Kept { }");
56await File.WriteAllTextAsync(obsolete, "class RemovedResource { }");
72Assert.True(File.Exists(kept));
73Assert.False(File.Exists(obsolete));
82await File.WriteAllTextAsync(handWritten, "class HandWritten { }");
89Assert.True(File.Exists(handWritten));
96await File.WriteAllTextAsync(filePath, "class Generated { }");
98File.SetLastWriteTimeUtc(filePath, originalWriteTime);
105Assert.Equal(originalWriteTime, File.GetLastWriteTimeUtc(filePath));
112await File.WriteAllTextAsync(filePath, "class Generated { }");
113File.SetLastWriteTimeUtc(filePath, new DateTime(2020, 1, 1, 0, 0, 0, DateTimeKind.Utc));
118Assert.Equal("class Generated { int x; }", await File.ReadAllTextAsync(filePath));
119Assert.True(File.GetLastWriteTimeUtc(filePath) > new DateTime(2020, 1, 2, 0, 0, 0, DateTimeKind.Utc));
130Assert.Equal("class New { }", await File.ReadAllTextAsync(filePath));
137await File.WriteAllTextAsync(filePath, "def add_redis(): ...");
139File.SetLastWriteTimeUtc(filePath, originalWriteTime);
147Assert.True(File.GetLastWriteTimeUtc(filePath) > originalWriteTime);
179File.WriteAllText(settingsPath, """
199File.WriteAllText(settingsPath, """
385File.WriteAllText(settingsPath, """
403var json = File.ReadAllText(settingsPath);
432var content = await File.ReadAllTextAsync(settingsPath);
445File.WriteAllText(launchSettingsPath, """
534File.WriteAllText(aspireConfigPath, """
726await File.WriteAllTextAsync(configPath, """
734await File.WriteAllTextAsync(appHostPath, "// test apphost");
779await File.WriteAllTextAsync(configPath, """
787await File.WriteAllTextAsync(appHostPath, "// test apphost");
820await File.WriteAllTextAsync(appHostPath, "// test apphost");
837Assert.False(File.Exists(socketPath));
844await File.WriteAllTextAsync(configPath, """
853await File.WriteAllTextAsync(appHostPath, "// test apphost");
900await File.WriteAllTextAsync(configPath, """
908await File.WriteAllTextAsync(appHostPath, "// test apphost");
955await File.WriteAllTextAsync(configPath, """
964await File.WriteAllTextAsync(appHostPath, "// test apphost");
1039await File.WriteAllTextAsync(configPath, seededJson);
1042await File.WriteAllTextAsync(appHostPath, "// test apphost");
1139await File.WriteAllTextAsync(appHostPath, "// test apphost");
1181await File.WriteAllTextAsync(appHostPath, "// test apphost");
1260await File.WriteAllTextAsync(configPath, $$"""
1268await File.WriteAllTextAsync(appHostPath, "// test apphost");
1349await File.WriteAllTextAsync(configPath, $$"""
1357await File.WriteAllTextAsync(appHostPath, "// test apphost");
1446File.WriteAllText(socketPath, "");
1585await File.WriteAllTextAsync(existingBundlePath, "existing certificate", TestContext.Current.CancellationToken);
1586await File.WriteAllTextAsync(devCertificatePath, "development certificate", TestContext.Current.CancellationToken);
1587var expectedDevCertificateContents = await File.ReadAllBytesAsync(devCertificatePath, TestContext.Current.CancellationToken);
1588var expectedExistingBundleContents = await File.ReadAllBytesAsync(existingBundlePath, TestContext.Current.CancellationToken);
1607await File.ReadAllBytesAsync(envVars["NODE_EXTRA_CA_CERTS"], TestContext.Current.CancellationToken));
1641await File.WriteAllTextAsync(existingBundlePath, existingBundleContents, TestContext.Current.CancellationToken);
1642await File.WriteAllTextAsync(inheritedBundlePath, inheritedBundleContents, TestContext.Current.CancellationToken);
1643await File.WriteAllTextAsync(devCertificatePath, devCertificateContents, TestContext.Current.CancellationToken);
1674Assert.Equal(expectedBundleContents, await File.ReadAllBytesAsync(expectedBundlePath, TestContext.Current.CancellationToken));
1677File.SetLastWriteTimeUtc(expectedBundlePath, cachedWriteTime);
1678cachedWriteTime = File.GetLastWriteTimeUtc(expectedBundlePath);
1689Assert.Equal(cachedWriteTime, File.GetLastWriteTimeUtc(expectedBundlePath));
1696File.GetUnixFileMode(Path.GetDirectoryName(expectedBundlePath)!));
1699File.GetUnixFileMode(expectedBundlePath));
1709await File.WriteAllTextAsync(devCertificatePath, "dev certificate", TestContext.Current.CancellationToken);
Projects\GuestRuntimeTests.cs (37)
755Assert.True(File.Exists(logFilePath), "Log file should exist");
756var logContents = await File.ReadAllTextAsync(logFilePath);
765if (File.Exists(logFilePath))
767File.Delete(logFilePath);
976Assert.False(File.Exists(migrationFilePath));
981Assert.True(File.Exists(migrationFilePath));
982var writtenContent = await File.ReadAllTextAsync(migrationFilePath);
998await File.WriteAllTextAsync(migrationFilePath, existingContent);
1025var writtenContent = await File.ReadAllTextAsync(migrationFilePath);
1059Assert.True(File.Exists(Path.Combine(workspace.WorkspaceRoot.FullName, "classes", ".aspire-compile-stamp")));
1090File.SetLastWriteTimeUtc(input, DateTime.UtcNow.AddMinutes(1));
1111File.WriteAllText(classFile, "");
1113File.SetLastWriteTimeUtc(classFile, DateTime.UtcNow.AddMinutes(1));
1138File.Delete(Path.Combine(workspace.WorkspaceRoot.FullName, relativeInput.Replace('/', Path.DirectorySeparatorChar)));
1154File.WriteAllText(pom, "<project/>");
1160File.SetLastWriteTimeUtc(pom, DateTime.UtcNow.AddMinutes(1));
1177File.WriteAllText(Path.Combine(dependencies, "guava-32.0.0.jar"), "");
1188File.Delete(Path.Combine(dependencies, "guava-32.0.0.jar"));
1189File.WriteAllText(Path.Combine(dependencies, "guava-33.0.0.jar"), "");
1207File.WriteAllText(jar, "");
1213File.SetLastWriteTimeUtc(jar, DateTime.UtcNow.AddMinutes(1));
1235File.WriteAllText(unrelated, "");
1237File.SetLastWriteTimeUtc(unrelated, DateTime.UtcNow.AddMinutes(1));
1277File.WriteAllText(nested, "class Resources { }");
1279File.SetLastWriteTimeUtc(nested, DateTime.UtcNow.AddMinutes(1));
1307File.WriteAllText(path, "");
1318File.SetLastWriteTimeUtc(path, DateTime.UtcNow.AddMinutes(1));
1348File.WriteAllText(Path.Combine(unreadable, "Hidden.java"), "class Hidden { }");
1373File.SetUnixFileMode(path, mode);
1389Assert.False(File.Exists(Path.Combine(workspace.WorkspaceRoot.FullName, "classes", ".aspire-compile-stamp")));
1415File.WriteAllText(appHostFile.FullName, "class AppHost { }");
1416File.WriteAllText(Path.Combine(root.FullName, "Helper.java"), "class Helper { }");
1420File.WriteAllText(Path.Combine(generated, "Generated.java"), "class Generated { }");
1424File.WriteAllText(Path.Combine(sources, "Service.java"), "class Service { }");
1439File.SetLastWriteTimeUtc(file, timestampUtc);
1455File.WriteAllText(stamp, "");
1456File.SetLastWriteTimeUtc(stamp, timestampUtc);
Projects\JavaAppHostToolchainResolverTests.cs (34)
14File.WriteAllText(path, "");
81File.WriteAllText(Path.Combine(workspace.Path, "pom.xml"), "<project />");
92File.WriteAllText(Path.Combine(workspace.Path, buildFileName), "");
101File.WriteAllText(Path.Combine(workspace.Path, "pom.xml"), "<project />");
102File.WriteAllText(Path.Combine(workspace.Path, "build.gradle"), "");
111File.WriteAllText(Path.Combine(workspace.Path, "pom.xml"), "<project />");
135File.WriteAllText(Path.Combine(workspace.Path, "pom.xml"), "<project />");
183File.WriteAllText(Path.Combine(workspace.Path, buildFileName), "");
234File.WriteAllText(Path.Combine(workspace.Path, "build.gradle"), "");
272File.WriteAllText(Path.Combine(workspace.Path, "pom.xml"), "<project />");
307File.WriteAllText(wrapperPath, "");
344File.WriteAllText(rootWrapperPath, "");
347File.WriteAllText(Path.Combine(moduleDirectory.FullName, useMaven ? "pom.xml" : "build.gradle"), "");
372File.WriteAllText(Path.Combine(workspace.Path, OperatingSystem.IsWindows() ? windowsWrapperName : wrapperName), "");
376File.WriteAllText(Path.Combine(innerCheckout.FullName, useMaven ? "pom.xml" : "build.gradle"), "");
388File.WriteAllText(Path.Combine(directory, "pom.xml"), "");
392File.WriteAllText(Path.Combine(directory, "settings.gradle"), "");
400File.WriteAllText(Path.Combine(workspace.Path, "build.gradle"), "");
407Assert.Contains("aspireCopyDependencies", await File.ReadAllTextAsync(scriptPath));
409await File.WriteAllTextAsync(scriptPath, "// stale");
412Assert.Contains("aspireCopyDependencies", await File.ReadAllTextAsync(scriptPath));
419File.WriteAllText(Path.Combine(workspace.Path, "build.gradle"), "");
424var script = await File.ReadAllTextAsync(Path.Combine(workspace.Path, ".aspire", "aspire-gradle-init.gradle"));
435File.WriteAllText(Path.Combine(workspace.Path, "pom.xml"), "<project />");
439await File.WriteAllTextAsync(Path.Combine(dependencyDirectory, "library-1.0.jar"), "");
452File.WriteAllText(Path.Combine(workspace.Path, "pom.xml"), "<project />");
463File.WriteAllText(Path.Combine(workspace.Path, "build.gradle"), "");
468await File.WriteAllTextAsync(Path.Combine(dependencyDirectory, "library-1.0.jar"), "");
485File.WriteAllText(Path.Combine(workspace.Path, "pom.xml"), "<project />");
502File.WriteAllText(Path.Combine(workspace.Path, buildFileName), "");
517File.WriteAllText(Path.Combine(workspace.Path, "pom.xml"), "<project />");
527File.WriteAllText(Path.Combine(workspace.Path, "pom.xml"), "<project />");
569File.WriteAllText(Path.Combine(workspace.Path, "build.gradle"), "");
579Assert.Contains("aspireCopyDependencies", await File.ReadAllTextAsync(scriptPath));
Projects\PrebuiltAppHostServerTests.cs (65)
33var firstWrite = File.GetLastWriteTimeUtc(path);
36File.SetLastWriteTimeUtc(path, firstWrite.AddMinutes(-5));
37var backdated = File.GetLastWriteTimeUtc(path);
40Assert.Equal(backdated, File.GetLastWriteTimeUtc(path));
41Assert.Equal("<Project />", await File.ReadAllTextAsync(path));
52Assert.Equal("<Project Sdk=\"Microsoft.NET.Sdk\" />", await File.ReadAllTextAsync(path));
62await File.WriteAllTextAsync(path, "<Project />");
69File.SetUnixFileMode(path, UnixFileMode.UserWrite);
76File.SetUnixFileMode(path, UnixFileMode.UserRead | UnixFileMode.UserWrite);
79Assert.Equal("<Project Sdk=\"Microsoft.NET.Sdk\" />", await File.ReadAllTextAsync(path));
122await File.WriteAllTextAsync(referencedProject, """<Project><ItemGroup><PackageReference Include="Aspire.Hosting" Version="13.5.0" /></ItemGroup></Project>""");
129await File.WriteAllTextAsync(referencedProject, """<Project><ItemGroup><PackageReference Include="Aspire.Hosting" Version="13.6.0-dev" /></ItemGroup></Project>""");
143await File.WriteAllTextAsync(referencedProject, """<Project><ItemGroup><PackageReference Include="Aspire.Hosting" /></ItemGroup></Project>""");
145await File.WriteAllTextAsync(packagesProps, """<Project><ItemGroup><PackageVersion Include="Aspire.Hosting" Version="13.5.0" /></ItemGroup></Project>""");
150await File.WriteAllTextAsync(packagesProps, """<Project><ItemGroup><PackageVersion Include="Aspire.Hosting" Version="13.6.0-dev" /></ItemGroup></Project>""");
161await File.WriteAllTextAsync(leaf, """<Project><ItemGroup><PackageReference Include="Aspire.Hosting" Version="13.5.0" /></ItemGroup></Project>""");
163await File.WriteAllTextAsync(referencedProject, """<Project><ItemGroup><ProjectReference Include="Leaf.csproj" /></ItemGroup></Project>""");
170await File.WriteAllTextAsync(leaf, """<Project><ItemGroup><PackageReference Include="Aspire.Hosting" Version="13.6.0-dev" /></ItemGroup></Project>""");
181await File.WriteAllTextAsync(leaf, """<Project><ItemGroup><PackageReference Include="Some.Package" Version="13.4.*" /></ItemGroup></Project>""");
183await File.WriteAllTextAsync(referencedProject, """<Project><ItemGroup><ProjectReference Include="Leaf.csproj" /></ItemGroup></Project>""");
199await File.WriteAllTextAsync(first, """<Project><ItemGroup><ProjectReference Include="Second.csproj" /></ItemGroup></Project>""");
200await File.WriteAllTextAsync(second, """<Project><ItemGroup><ProjectReference Include="First.csproj" /></ItemGroup></Project>""");
213await File.WriteAllTextAsync(referencedProject, "<Project />");
229await File.WriteAllTextAsync(referencedProject, """<Project><ItemGroup><PackageReference Include="Some.Package" Version="13.4.*" /></ItemGroup></Project>""");
242await File.WriteAllTextAsync(referencedProject, """<Project ToolsVersion="4.0"><ItemGroup><PackageReference Include="Some.Package" Version="13.5.0" /></ItemGroup></Project>""");
356File.WriteAllText(Path.Combine(objDir, "project.assets.json"), "{}");
359File.WriteAllText(Path.Combine(objDir, "aspire-restore.stamp"), fingerprint);
1373await File.WriteAllTextAsync(aspireConfigPath, """
1403Assert.True(File.Exists(appSettingsPath));
1405var appSettingsContent = await File.ReadAllTextAsync(appSettingsPath);
1564await File.WriteAllTextAsync(aspireConfigPath, $$"""
1623await File.WriteAllTextAsync(aspireConfigPath, """
1683await File.WriteAllTextAsync(aspireConfigPath, """
1742await File.WriteAllTextAsync(aspireConfigPath, """
1802await File.WriteAllTextAsync(aspireConfigPath, $$"""
1857await File.WriteAllTextAsync(aspireConfigPath, """
1922await File.WriteAllTextAsync(aspireConfigPath, """
2005await File.WriteAllTextAsync(aspireConfigPath, """
2094await File.WriteAllTextAsync(aspireConfigPath, """
2176await File.WriteAllTextAsync(aspireConfigPath, """
2252restoreConfigFileExistedDuringBuild = restoreConfigFile is not null && File.Exists(restoreConfigFile);
2317temporaryNuGetConfigContent = File.ReadAllText(GetArgumentValue(args, "--nuget-config"));
2399Assert.True(File.Exists(Path.Combine(layoutPath, "libs", "MyIntegration.dll")));
2473await using var probeManifestStream = File.OpenRead(probeManifestPath);
2527await using var probeManifestStream = File.OpenRead(probeManifestPath);
2611await File.WriteAllTextAsync(copiedFilePath, "corrupt");
2617Assert.Equal("integration-v1", await File.ReadAllTextAsync(copiedFilePath));
2658Assert.True(File.Exists(lockedFilePath));
2659Assert.True(File.Exists(Path.Combine(secondLayoutPath, "libs", "MyIntegration.dll")));
2678File.WriteAllText(firstSourcePath, "redis");
2679File.WriteAllText(secondSourcePath, "redis");
2724File.WriteAllText(firstPackagePath, "redis");
2725File.WriteAllText(secondPackagePath, "redis");
2726File.WriteAllText(projectPath, "integration");
2785File.SetLastWriteTimeUtc(packageSourcePath, File.GetLastWriteTimeUtc(packageSourcePath).AddMinutes(5));
2858File.WriteAllText(
2887if (!File.Exists(sourcePath) || File.ReadAllText(sourcePath) != content)
2889File.WriteAllText(sourcePath, content);
2900File.WriteAllLines(Path.Combine(restoreDirectory.FullName, PrebuiltAppHostServer.ClosureMetadataFileName), metadataLines);
2901File.WriteAllLines(Path.Combine(restoreDirectory.FullName, PrebuiltAppHostServer.ClosureSourcesFileName), sourcePaths);
2902File.WriteAllLines(Path.Combine(restoreDirectory.FullName, PrebuiltAppHostServer.ClosureTargetsFileName), targetPaths);
2903File.WriteAllLines(Path.Combine(restoreDirectory.FullName, PrebuiltAppHostServer.ProjectRefAssemblyNamesFileName), projectReferenceAssemblyNames);
2946File.WriteAllText(Path.Combine(objDirectory.FullName, "project.assets.json"), projectAssetsContent);
Projects\ProjectLocatorTests.cs (218)
49await File.WriteAllTextAsync(
65await File.WriteAllTextAsync(firstAppHostProjectFile.FullName, "Not a real apphost");
69await File.WriteAllTextAsync(secondAppHostProjectFile.FullName, "Not a real apphost");
73await File.WriteAllTextAsync(configPath, originalConfig);
86Assert.Equal(originalConfig, await File.ReadAllTextAsync(configPath));
96await File.WriteAllTextAsync(firstAppHostProjectFile.FullName, "Not a real apphost");
100await File.WriteAllTextAsync(secondAppHostProjectFile.FullName, "Not a real apphost");
104await File.WriteAllTextAsync(configPath, originalConfig);
115Assert.Equal(originalConfig, await File.ReadAllTextAsync(configPath));
125await File.WriteAllTextAsync(firstAppHostProjectFile.FullName, "Not a real apphost");
129await File.WriteAllTextAsync(secondAppHostProjectFile.FullName, "Not a real apphost");
133await File.WriteAllTextAsync(configPath, originalConfig);
146Assert.Equal(originalConfig, await File.ReadAllTextAsync(configPath));
158await File.WriteAllTextAsync(firstAppHostProjectFile.FullName, "Not a real apphost");
162await File.WriteAllTextAsync(secondAppHostProjectFile.FullName, "Not a real apphost");
165await File.WriteAllTextAsync(configPath, """{"appHost":{"path":"FirstAppHost/FirstAppHost.csproj"}}""");
191await File.WriteAllTextAsync(firstAppHostProjectFile.FullName, "Not a real apphost");
195await File.WriteAllTextAsync(firstAlternative.FullName, "Not a real apphost");
197await File.WriteAllTextAsync(secondAlternative.FullName, "Not a real apphost");
200await File.WriteAllTextAsync(configPath, """{"appHost":{"path":"FirstAppHost/FirstAppHost.csproj"}}""");
224await File.WriteAllTextAsync(firstAppHostProjectFile.FullName, "Not a real apphost");
228await File.WriteAllTextAsync(alternativeAppHost.FullName, "Not a real apphost");
232await File.WriteAllTextAsync(configPath, originalConfig);
243Assert.Equal(originalConfig, await File.ReadAllTextAsync(configPath));
253await File.WriteAllTextAsync(appHostProjectFile.FullName, "Not a real apphost");
277await File.WriteAllTextAsync(appHostProjectFile.FullName, "Not a real apphost");
302await File.WriteAllTextAsync(appHostProjectFile.FullName, "Not a real apphost");
307await File.WriteAllTextAsync(configPath, """{"sdk":{"version":"9.9.9"}}""");
341using (var document = JsonDocument.Parse(await File.ReadAllTextAsync(configPath)))
372await File.WriteAllTextAsync(firstAppHostProjectFile.FullName, "Not a real apphost");
376await File.WriteAllTextAsync(secondAppHostProjectFile.FullName, "Not a real apphost");
379await File.WriteAllTextAsync(configPath, """{"appHost":{"path":"FirstAppHost/FirstAppHost.csproj"}}""");
403await File.WriteAllTextAsync(firstAppHostProjectFile.FullName, "Not a real apphost");
407await File.WriteAllTextAsync(secondAppHostProjectFile.FullName, "Not a real apphost");
411await File.WriteAllTextAsync(configPath, originalConfig);
429Assert.Equal(originalConfig, await File.ReadAllTextAsync(configPath));
439await File.WriteAllTextAsync(firstAppHostProjectFile.FullName, "Not a real apphost");
443await File.WriteAllTextAsync(secondAppHostProjectFile.FullName, "Not a real apphost");
446await File.WriteAllTextAsync(configPath, """{"appHost":{"path":"FirstAppHost/FirstAppHost.csproj"}}""");
478using var document = JsonDocument.Parse(File.ReadAllText(configPath));
509await File.WriteAllTextAsync(projectFile.FullName, "<Project Sdk=\"Aspire.AppHost.Sdk\"></Project>");
529Assert.False(File.Exists(Path.Combine(workspace.WorkspaceRoot.FullName, AspireConfigFile.FileName)));
541await File.WriteAllTextAsync(brokenAppHost.FullName, "<Project Sdk=\"Aspire.AppHost.Sdk\"></Project>");
545await File.WriteAllTextAsync(decoyAppHost.FullName, "<Project Sdk=\"Aspire.AppHost.Sdk\"></Project>");
550await File.WriteAllTextAsync(aspireSettingsFile.FullName, JsonSerializer.Serialize(new
579Assert.False(File.Exists(Path.Combine(workspace.WorkspaceRoot.FullName, AspireConfigFile.FileName)));
591await File.WriteAllTextAsync(outsideAppHost.FullName, "<Project Sdk=\"Aspire.AppHost.Sdk\"></Project>");
595await File.WriteAllTextAsync(configPath, JsonSerializer.Serialize(new
629await File.WriteAllTextAsync(appHostFile.FullName, "<Project Sdk=\"Aspire.AppHost.Sdk\"></Project>");
692await File.WriteAllTextAsync(projectFile.FullName, "<Project Sdk=\"Microsoft.NET.Sdk.Web\"></Project>");
721await File.WriteAllTextAsync(targetAppHostProjectFile.FullName, "Not a real apphost");
725await File.WriteAllTextAsync(otherAppHostProjectFile.FullName, "Not a real apphost");
754await File.WriteAllTextAsync(targetAppHostProjectFile.FullName, "Not a real apphost");
785await File.WriteAllTextAsync(targetAppHostProjectFile.FullName, "Not a real apphost");
812await File.WriteAllTextAsync(realAppHostProjectFile.FullName, "Not a real apphost project");
853await File.WriteAllTextAsync(staleProjectFile.FullName, "Not a real apphost project");
856await File.WriteAllTextAsync(realAppHostProjectFile.FullName, "Not a real apphost project");
906await File.WriteAllTextAsync(aspireSettingsFile.FullName, JsonSerializer.Serialize(new
929await File.WriteAllTextAsync(configPath, JsonSerializer.Serialize(new
964await File.WriteAllTextAsync(targetAppHostProjectFile.FullName, "Not a real apphost");
968await File.WriteAllTextAsync(decoyAppHostProjectFile.FullName, "Not a real apphost");
971await File.WriteAllTextAsync(configPath, JsonSerializer.Serialize(new
1002await File.WriteAllTextAsync(targetAppHostProjectFile.FullName, "Not a real apphost");
1006await File.WriteAllTextAsync(decoyAppHostProjectFile.FullName, "Not a real apphost");
1009await File.WriteAllTextAsync(configPath, JsonSerializer.Serialize(new
1039await File.WriteAllTextAsync(guestAppHostFile.FullName, "// guest apphost");
1042await File.WriteAllTextAsync(configPath, JsonSerializer.Serialize(new
1076await File.WriteAllTextAsync(configuredAppHostProjectFile.FullName, "Not a real apphost");
1079await File.WriteAllTextAsync(realAppHostProjectFile.FullName, "Not a real apphost");
1082await File.WriteAllTextAsync(configPath, JsonSerializer.Serialize(new
1129await File.WriteAllTextAsync(configuredAppHostProjectFile.FullName, "Not a real apphost");
1132await File.WriteAllTextAsync(realAppHostProjectFile.FullName, "Not a real apphost");
1135await File.WriteAllTextAsync(configPath, JsonSerializer.Serialize(new
1181await File.WriteAllTextAsync(targetAppHostProjectFile.FullName, "Not a real apphost");
1185await File.WriteAllTextAsync(otherAppHostProjectFile.FullName, "Not a real apphost");
1188await File.WriteAllTextAsync(configPath, JsonSerializer.Serialize(new
1218await File.WriteAllTextAsync(settingsAppHostFile.FullName, "Not a real apphost");
1224await File.WriteAllTextAsync(configPath, JsonSerializer.Serialize(new
1257await File.WriteAllTextAsync(settingsAppHostFile.FullName, "Not a supported apphost type");
1260await File.WriteAllTextAsync(configPath, JsonSerializer.Serialize(new
1292await File.WriteAllTextAsync(targetAppHostProjectFile.FullName, "Not a real apphost");
1322await File.WriteAllTextAsync(projectFile1.FullName, "Not a real project file.");
1325await File.WriteAllTextAsync(projectFile2.FullName, "Not a real project file.");
1340await File.WriteAllTextAsync(appHostProject.FullName, "Not a real apphost project.");
1343await File.WriteAllTextAsync(webProject.FullName, "Not a real web project.");
1386await File.WriteAllTextAsync(projectFile.FullName, "Not a real project file.");
1404await File.WriteAllTextAsync(onDiskProjectFile.FullName, "Not a real project file.");
1413Assert.True(File.Exists(mismatchedCasePath));
1433await File.WriteAllTextAsync(projectFile.FullName, "Not a real project file.");
1449await File.WriteAllTextAsync(appHostFile.FullName, "// TypeScript AppHost");
1451await File.WriteAllTextAsync(Path.Combine(workspace.WorkspaceRoot.FullName, AspireConfigFile.FileName), JsonSerializer.Serialize(new
1487await File.WriteAllTextAsync(appHostProjectFile.FullName, "Not a real project file.");
1509var settingsJson = await File.ReadAllTextAsync(settingsFile.FullName);
1524await File.WriteAllTextAsync(appHostFile.FullName, "// TypeScript apphost");
1527await File.WriteAllTextAsync(
1571Assert.False(File.Exists(Path.Combine(workspace.WorkspaceRoot.FullName, AspireConfigFile.FileName)));
1573var adjacentConfigJson = await File.ReadAllTextAsync(adjacentConfigPath);
1591await File.WriteAllTextAsync(appHost1File.FullName, "// TypeScript apphost");
1593await File.WriteAllTextAsync(appHost1ConfigPath, """
1603await File.WriteAllTextAsync(appHost2File.FullName, "// TypeScript apphost");
1605await File.WriteAllTextAsync(appHost2ConfigPath, """
1641Assert.False(File.Exists(Path.Combine(workspace.WorkspaceRoot.FullName, AspireConfigFile.FileName)));
1643var appHost1ConfigJson = await File.ReadAllTextAsync(appHost1ConfigPath);
1648var appHost2ConfigJson = await File.ReadAllTextAsync(appHost2ConfigPath);
1661await File.WriteAllTextAsync(appHostFile.FullName, "// TypeScript apphost");
1695Assert.False(File.Exists(Path.Combine(workspace.WorkspaceRoot.FullName, AspireConfigFile.FileName)));
1710await File.WriteAllTextAsync(appHostProjectFile.FullName, "Not a real apphost");
1721await File.WriteAllTextAsync(aspireSettingsFile.FullName, JsonSerializer.Serialize(new { appHostPath = relativeAppHostPath }));
1740Assert.True(File.Exists(aspireConfigFilePath), "aspire.config.json should have been created by migration from .aspire/settings.json");
1742var configJson = await File.ReadAllTextAsync(aspireConfigFilePath);
1754await File.WriteAllTextAsync(
1779await File.WriteAllTextAsync(
1805await File.WriteAllTextAsync(
1815await File.WriteAllTextAsync(csprojFile.FullName, "<Project Sdk=\"Microsoft.NET.Sdk\"></Project>");
1820await File.WriteAllTextAsync(
1860await File.WriteAllTextAsync(appHostFile.FullName, @"using Aspire.Hosting
1880await File.WriteAllTextAsync(csprojFile.FullName, "<Project Sdk=\"Microsoft.NET.Sdk\"></Project>");
1885await File.WriteAllTextAsync(
1921await File.WriteAllTextAsync(projectFile.FullName, "Not a real project file.");
1948await File.WriteAllTextAsync(
1972await File.WriteAllTextAsync(appHostFile.FullName, @"using Aspire.Hosting;
1993await File.WriteAllTextAsync(appHostFile.FullName, "using Aspire.Hosting;");
1996await File.WriteAllTextAsync(projectFile.FullName, "<Project Sdk=\"Aspire.AppHost.Sdk\"></Project>");
2019await File.WriteAllTextAsync(
2030await File.WriteAllTextAsync(csprojFile.FullName, "<Project Sdk=\"Microsoft.NET.Sdk\"></Project>");
2045await File.WriteAllTextAsync(txtFile.FullName, "Some text file");
2065await File.WriteAllTextAsync(csprojFile.FullName, "<Project Sdk=\"Microsoft.NET.Sdk\"></Project>");
2070await File.WriteAllTextAsync(
2257await File.WriteAllTextAsync(projectFile.FullName, "Not a real project file.");
2312await File.WriteAllTextAsync(projectFile.FullName, "<Project Sdk=\"Aspire.AppHost.Sdk\"></Project>");
2329Assert.False(File.Exists(Path.Combine(workspace.WorkspaceRoot.FullName, AspireConfigFile.FileName)));
2342await File.WriteAllTextAsync(first.FullName, "<Project Sdk=\"Aspire.AppHost.Sdk\"></Project>");
2345await File.WriteAllTextAsync(second.FullName, "<Project Sdk=\"Aspire.AppHost.Sdk\"></Project>");
2382await File.WriteAllTextAsync(brokenAppHost.FullName, "<Project Sdk=\"Aspire.AppHost.Sdk\"></Project>");
2387await File.WriteAllTextAsync(configPath, JsonSerializer.Serialize(new
2424await File.WriteAllTextAsync(healthyAppHost.FullName, "<Project Sdk=\"Aspire.AppHost.Sdk\"></Project>");
2429await File.WriteAllTextAsync(brokenAppHost.FullName, "<Project Sdk=\"Aspire.AppHost.Sdk\"></Project>");
2432await File.WriteAllTextAsync(configPath, JsonSerializer.Serialize(new
2465await File.WriteAllTextAsync(configuredAppHost.FullName, "<Project Sdk=\"Aspire.AppHost.Sdk\"></Project>");
2470await File.WriteAllTextAsync(firstAppHost.FullName, "<Project Sdk=\"Aspire.AppHost.Sdk\"></Project>");
2473await File.WriteAllTextAsync(secondAppHost.FullName, "<Project Sdk=\"Aspire.AppHost.Sdk\"></Project>");
2476await File.WriteAllTextAsync(configPath, JsonSerializer.Serialize(new
2510await File.WriteAllTextAsync(unsupportedAppHost.FullName, "<Project Sdk=\"Aspire.AppHost.Sdk\"></Project>");
2515await File.WriteAllTextAsync(configPath, JsonSerializer.Serialize(new
2564await File.WriteAllTextAsync(brokenAppHost.FullName, "<Project Sdk=\"Aspire.AppHost.Sdk\"></Project>");
2568await File.WriteAllTextAsync(firstHealthy.FullName, "<Project Sdk=\"Aspire.AppHost.Sdk\"></Project>");
2572await File.WriteAllTextAsync(secondHealthy.FullName, "<Project Sdk=\"Aspire.AppHost.Sdk\"></Project>");
2575await File.WriteAllTextAsync(configPath, JsonSerializer.Serialize(new
2614await File.WriteAllTextAsync(projectFile1.FullName, "Not a real project file.");
2616await File.WriteAllTextAsync(projectFile2.FullName, "Not a real project file.");
2651await File.WriteAllTextAsync(
2679await File.WriteAllTextAsync(projectFile.FullName, "Not a real project file.");
2718await File.WriteAllTextAsync(csprojFile.FullName, "<Project Sdk=\"Microsoft.NET.Sdk\"></Project>");
2723await File.WriteAllTextAsync(appHostCsFile.FullName, """
2761await File.WriteAllTextAsync(csprojFile.FullName, "<Project Sdk=\"Microsoft.NET.Sdk\"></Project>");
2765await File.WriteAllTextAsync(appHostCsFile.FullName, """
2803await File.WriteAllTextAsync(appHostCsFile.FullName, """
2826await File.WriteAllTextAsync(projectFile.FullName, "Not a real project file.");
2847await File.WriteAllTextAsync(projectFile.FullName, "Not a real project file.");
2869await File.WriteAllTextAsync(projectFile.FullName, "Not a real project file.");
2922await File.WriteAllTextAsync(normalProject.FullName, "Not a real project file.");
2929await File.WriteAllTextAsync(cachedProject.FullName, "Not a real project file.");
2959await File.WriteAllTextAsync(project1.FullName, "Not a real project file.");
2963await File.WriteAllTextAsync(project2.FullName, "Not a real project file.");
2990await File.WriteAllTextAsync(normalProject.FullName, "Not a real project file.");
2997await File.WriteAllTextAsync(cachedProject.FullName, "Not a real project file.");
3031await File.WriteAllTextAsync(siblingProject.FullName, "Not a real project file.");
3037await File.WriteAllTextAsync(cachedProject.FullName, "Not a real project file.");
3067await File.WriteAllTextAsync(appHostFile.FullName, "Not a real apphost");
3090await File.WriteAllTextAsync(appHost1File.FullName, "Not a real apphost");
3096await File.WriteAllTextAsync(appHost2File.FullName, "Not a real apphost");
3120await File.WriteAllTextAsync(appHostFile.FullName, "Not a real apphost");
3143await File.WriteAllTextAsync(Path.Combine(appHost1Dir.FullName, "AppHost1.csproj"), "Not a real apphost");
3146await File.WriteAllTextAsync(Path.Combine(appHost2Dir.FullName, "AppHost2.csproj"), "Not a real apphost");
3165await File.WriteAllTextAsync(appHost1File.FullName, "Not a real apphost");
3168await File.WriteAllTextAsync(appHost2File.FullName, "Not a real apphost");
3171await File.WriteAllTextAsync(slowValidationFile.FullName, "Not a real apphost");
3224await File.WriteAllTextAsync(appHost1File.FullName, "Not a real apphost");
3228await File.WriteAllTextAsync(appHost2File.FullName, "Not a real apphost");
3237await File.WriteAllTextAsync(aspireSettingsFile.FullName, JsonSerializer.Serialize(new { appHostPath = relativeAppHostPath }));
3257await File.WriteAllTextAsync(appHost1File.FullName, "Not a real apphost");
3261await File.WriteAllTextAsync(appHost2File.FullName, "Not a real apphost");
3270await File.WriteAllTextAsync(aspireSettingsFile.FullName, JsonSerializer.Serialize(new { appHostPath = relativeAppHostPath }));
3292await File.WriteAllTextAsync(realAppHost.FullName, "Not a real project file.");
3297await File.WriteAllTextAsync(staleAppHost.FullName, "Not a real project file.");
3320await File.WriteAllTextAsync(realAppHost.FullName, "Not a real project file.");
3324await File.WriteAllTextAsync(staleAppHost.FullName, "Not a real project file.");
3349await File.WriteAllTextAsync(realAppHost.FullName, "Not a real project file.");
3353await File.WriteAllTextAsync(skipListedAppHost.FullName, "Not a real project file.");
3378await File.WriteAllTextAsync(buildableAppHost.FullName, "Not a real project file.");
3382await File.WriteAllTextAsync(unbuildableAppHost.FullName, "Not a real project file.");
3417await File.WriteAllTextAsync(realAppHost.FullName, "Not a real project file.");
3422await File.WriteAllTextAsync(staleAppHost.FullName, "Not a real project file.");
3456await File.WriteAllTextAsync(configuredAppHost.FullName, "<Project Sdk=\"Aspire.AppHost.Sdk\"></Project>");
3460await File.WriteAllTextAsync(configPath, JsonSerializer.Serialize(new
3492await File.WriteAllTextAsync(trackedAppHost.FullName, "Not a real project file.");
3496await File.WriteAllTextAsync(ignoredAppHost.FullName, "Not a real project file.");
3527await File.WriteAllTextAsync(realAppHost.FullName, "Not a real project file.");
3532await File.WriteAllTextAsync(nodeModulesAppHost.FullName, "Not a real project file.");
3564await File.WriteAllTextAsync(realAppHost.FullName, "Not a real project file.");
3620await File.WriteAllTextAsync(appHostProjectFile.FullName, "Not a real apphost");
3687await File.WriteAllTextAsync(appHostProjectFile.FullName, "Not a real apphost");
3720await File.WriteAllTextAsync(appHostProjectFile.FullName, "Not a real apphost");
3806await File.WriteAllTextAsync(configPath, """
3834await File.WriteAllTextAsync(aspireSettingsFile.FullName, """
3861await File.WriteAllTextAsync(configPath, """
3886await File.WriteAllTextAsync(aspireSettingsFile.FullName, """
3911await File.WriteAllTextAsync(configPath, """
3941await File.WriteAllTextAsync(settingsPath, """
3968await File.WriteAllTextAsync(settingsPath, """
3995await File.WriteAllTextAsync(settingsPath, """
4033await File.WriteAllTextAsync(realAppHost.FullName, "Not a real project file.");
4057Assert.True(File.Exists(pathThroughLink), "Symlinked path should resolve to the real apphost file.");
4095await File.WriteAllTextAsync(appHostProjectFile.FullName, "Not a real project file.");
4098if (!File.Exists(differentlyCasedPath))
4106await File.WriteAllTextAsync(configPath, $$"""
4130await File.WriteAllTextAsync(configuredAppHost.FullName, "Not a real project file.");
4133await File.WriteAllTextAsync(configPath, JsonSerializer.Serialize(new
Projects\ProjectUpdaterTests.cs (93)
39await File.WriteAllTextAsync(
149await File.WriteAllTextAsync(
161await File.WriteAllTextAsync(
288var updatedConfig = await File.ReadAllTextAsync(aspireConfigFile.FullName);
313await File.WriteAllTextAsync(
420await File.WriteAllTextAsync(
429await File.WriteAllTextAsync(
571var updatedConfig = await File.ReadAllTextAsync(aspireConfigFile.FullName);
584await File.WriteAllTextAsync(
713await File.WriteAllTextAsync(
843await File.WriteAllTextAsync(
852await File.WriteAllTextAsync(
866await File.WriteAllTextAsync(
958var updatedContent = await File.ReadAllTextAsync(directoryPackagesPropsFile.FullName);
976await File.WriteAllTextAsync(
988await File.WriteAllTextAsync(
1063var updatedContent = await File.ReadAllTextAsync(directoryPackagesPropsFile.FullName);
1078await File.WriteAllTextAsync(
1090await File.WriteAllTextAsync(
1166var content = await File.ReadAllTextAsync(directoryPackagesPropsFile.FullName);
1201await File.WriteAllTextAsync(
1216await File.WriteAllTextAsync(
1291var updatedContent = await File.ReadAllTextAsync(directoryPackagesPropsFile.FullName);
1308await File.WriteAllTextAsync(
1371var updatedContent = await File.ReadAllTextAsync(appHostProjectFile.FullName);
1396await File.WriteAllTextAsync(appHostProjectFile.FullName, ProjectContent);
1445var unchangedContent = await File.ReadAllTextAsync(appHostProjectFile.FullName);
1465await File.WriteAllTextAsync(
1480await File.WriteAllTextAsync(
1540var updatedProject = await File.ReadAllTextAsync(appHostProjectFile.FullName);
1541var updatedProps = await File.ReadAllTextAsync(directoryPackagesPropsFile.FullName);
1562Assert.False(File.Exists(Path.Combine(workspace.WorkspaceRoot.FullName, "nuget.config")));
1563Assert.False(File.Exists(Path.Combine(appHostProjectFile.DirectoryName!, "nuget.config")));
1578await File.WriteAllTextAsync(nugetConfigPath,
1611Assert.True(File.Exists(nugetConfigPath));
1612var updatedConfig = await File.ReadAllTextAsync(nugetConfigPath);
1631Assert.True(File.Exists(Path.Combine(workspace.WorkspaceRoot.FullName, "nuget.config")));
1639await File.WriteAllTextAsync(
1779await File.WriteAllTextAsync(
1791await File.WriteAllTextAsync(
1877var content = await File.ReadAllTextAsync(directoryPackagesPropsFile.FullName);
1892await File.WriteAllTextAsync(
1905await File.WriteAllTextAsync(
2000var content = await File.ReadAllTextAsync(directoryPackagesPropsFile.FullName);
2016await File.WriteAllTextAsync(
2028await File.WriteAllTextAsync(
2130await File.WriteAllTextAsync(
2142await File.WriteAllTextAsync(
2239await File.WriteAllTextAsync(
2335await File.WriteAllTextAsync(
2347await File.WriteAllTextAsync(
2435await File.WriteAllTextAsync(
2513await File.WriteAllTextAsync(
2596await File.WriteAllTextAsync(
2665var updatedContent = await File.ReadAllTextAsync(appHostFile.FullName);
2688await File.WriteAllTextAsync(
2760var updatedContent = await File.ReadAllTextAsync(appHostFile.FullName);
2782await File.WriteAllTextAsync(
2845var updatedContent = await File.ReadAllTextAsync(appHostFile.FullName);
2859await File.WriteAllTextAsync(
2928var updatedContent = await File.ReadAllTextAsync(appHostFile.FullName);
2940await File.WriteAllTextAsync(
3027await File.WriteAllTextAsync(
3091var updatedContent = await File.ReadAllTextAsync(appHostProjectFile.FullName);
3105await File.WriteAllTextAsync(
3170var updatedContent = await File.ReadAllTextAsync(appHostProjectFile.FullName);
3182await File.WriteAllTextAsync(
3309await File.WriteAllTextAsync(
3326await File.WriteAllTextAsync(
3419var directoryPackagesContent = await File.ReadAllTextAsync(directoryPackagesPropsFile.FullName);
3442await File.WriteAllTextAsync(projectFile, originalContent);
3450var updatedContent = await File.ReadAllTextAsync(projectFile);
3474await File.WriteAllTextAsync(projectFile, originalContent);
3482var updatedContent = await File.ReadAllTextAsync(projectFile);
3511await File.WriteAllTextAsync(projectFile, originalContent);
3519var updatedContent = await File.ReadAllTextAsync(projectFile);
3547await File.WriteAllTextAsync(projectFile, originalContent);
3555var updatedContent = await File.ReadAllTextAsync(projectFile);
3579await File.WriteAllTextAsync(projectFile, originalContent);
3587var updatedContent = await File.ReadAllTextAsync(projectFile);
3612await File.WriteAllTextAsync(projectFile, originalContent);
3620var updatedContent = await File.ReadAllTextAsync(projectFile);
3654await File.WriteAllTextAsync(projectFile, originalContent);
3658await File.WriteAllTextAsync(directoryPackagesPropsFile, """
3676var updatedPropsContent = await File.ReadAllTextAsync(directoryPackagesPropsFile);
3682var updatedCsprojContent = await File.ReadAllTextAsync(projectFile);
3712await File.WriteAllTextAsync(
3826await File.WriteAllTextAsync(
3903await File.WriteAllTextAsync(
3956await File.WriteAllTextAsync(
3980var updatedContent = await File.ReadAllTextAsync(existingConfigFile.FullName);
3993await File.WriteAllTextAsync(
4057var content = await File.ReadAllTextAsync(createdConfig.FullName);
Projects\TypeScriptAppHostToolchainResolverTests.cs (29)
18File.WriteAllText(Path.Combine(workspace.WorkspaceRoot.FullName, "package.json"), "{ \"packageManager\": \"bun@1.2.0\" }");
29File.WriteAllText(Path.Combine(workspace.WorkspaceRoot.FullName, "package.json"), "{ \"name\": \"apphost\" }");
30File.WriteAllText(Path.Combine(workspace.WorkspaceRoot.FullName, "pnpm-lock.yaml"), "lockfileVersion: '9.0'");
42File.WriteAllText(packageJsonPath, "{ \"packageManager\": \"yarn@1.22.22\" }");
53File.WriteAllText(Path.Combine(workspace.WorkspaceRoot.FullName, "package.json"), "{ \"packageManager\": \"yarn@4.14.1\" }");
64File.WriteAllText(Path.Combine(workspace.WorkspaceRoot.FullName, "package.json"), "{ \"name\": \"apphost\" }");
66File.WriteAllText(yarnLockPath, "# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.\n# yarn lockfile v1\n");
79File.WriteAllText(Path.Combine(appHostDirectory.FullName, "package.json"), "{ \"name\": \"apphost\" }");
80File.WriteAllText(Path.Combine(parentDirectory.FullName, "package.json"), "{ \"name\": \"workspace\" }");
82File.WriteAllText(yarnLockPath, "# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.\n# yarn lockfile v1\n");
95File.WriteAllText(Path.Combine(parentDirectory.FullName, "package.json"), "{ \"name\": \"workspace\" }");
96File.WriteAllText(Path.Combine(parentDirectory.FullName, "yarn.lock"), string.Empty);
97File.WriteAllText(Path.Combine(appHostDirectory.FullName, "package.json"), "{ \"name\": \"apphost\" }");
98File.WriteAllText(Path.Combine(appHostDirectory.FullName, "package-lock.json"), "{}");
110File.WriteAllText(Path.Combine(workspace.WorkspaceRoot.FullName, "package.json"), "{ \"name\": \"apphost\" }");
111File.WriteAllText(Path.Combine(workspace.WorkspaceRoot.FullName, "package-lock.json"), "{}");
112File.WriteAllText(Path.Combine(workspace.WorkspaceRoot.FullName, "yarn.lock"), string.Empty);
124File.WriteAllText(Path.Combine(workspace.WorkspaceRoot.FullName, "package.json"), "{ \"name\": \"apphost\" }");
136File.WriteAllText(Path.Combine(workspace.WorkspaceRoot.FullName, "package.json"), "{ \"name\": \"apphost\" }");
147File.WriteAllText(Path.Combine(workspace.WorkspaceRoot.FullName, "package.json"), "{ \"name\": \"apphost\" }");
148File.WriteAllText(Path.Combine(workspace.WorkspaceRoot.FullName, "yarn.lock"), string.Empty);
167File.WriteAllText(Path.Combine(appHostDirectory.Parent!.FullName, "package.json"), "{ \"packageManager\": \"pnpm@10.12.1\" }");
168File.WriteAllText(Path.Combine(appHostDirectory.FullName, "package.json"), "{ \"name\": \"apphost\" }");
181File.WriteAllText(Path.Combine(appHostDirectory.Parent!.FullName, "package.json"), "{ \"packageManager\": \"pnpm@10.12.1\" }");
182File.WriteAllText(Path.Combine(appHostDirectory.FullName, "package.json"), "{ \"packageManager\": \"bun@1.2.0\" }");
196File.WriteAllText(Path.Combine(appHostDirectory.Parent!.FullName, "package.json"), "{ \"packageManager\": \"yarn@4.14.1\" }");
197File.WriteAllText(Path.Combine(appHostDirectory.FullName, "package.json"), "{ \"name\": \"apphost\" }");
198File.WriteAllText(Path.Combine(appHostDirectory.FullName, "pnpm-lock.yaml"), "lockfileVersion: '9.0'");
210File.WriteAllText(Path.Combine(workspace.WorkspaceRoot.FullName, "package.json"), "{ \"packageManager\": \"bun@1.2.0\" }");
Scaffolding\ScaffoldingServiceTests.cs (8)
36File.WriteAllText(Path.Combine(rootDirectory.FullName, "package.json"), "{}");
74File.WriteAllText(Path.Combine(rootDirectory.FullName, "package.json"), "{}");
141File.WriteAllText(Path.Combine(rootDirectory.FullName, "package.json"), "{ \"packageManager\": \"npm@10.0.0\" }");
142File.WriteAllText(Path.Combine(appHostDirectory.FullName, "package.json"), "{ \"packageManager\": \"pnpm@10.0.0\" }");
235File.WriteAllText(Path.Combine(rootDirectory.FullName, ".gitignore"), "node_modules/\n");
236File.WriteAllText(Path.Combine(rootDirectory.FullName, "package.json"), "{}");
237File.WriteAllText(Path.Combine(rootDirectory.FullName, "apphost.mts"), string.Empty);
275File.WriteAllText(Path.Combine(rootDirectory.FullName, ".vscode", "settings.json"), "{}");
Telemetry\InternalMicrosoftDetectorTests.cs (7)
25await File.WriteAllTextAsync(cacheFilePath, """
64await File.WriteAllTextAsync(cacheFilePath, """
84var updatedCache = await File.ReadAllTextAsync(cacheFilePath);
257await File.WriteAllTextAsync(Path.Combine(workspace.Path, "dsregcmd"), string.Empty);
258await File.WriteAllTextAsync(Path.Combine(workspace.Path, "dsregcmd.EXE"), string.Empty);
294await File.WriteAllTextAsync(Path.Combine(workspace.Path, "dsregcmd"), string.Empty);
295await File.WriteAllTextAsync(Path.Combine(workspace.Path, "dsregcmd.EXE"), string.Empty);
Templating\DotNetTemplateFactoryTests.cs (16)
40await File.WriteAllTextAsync(path, content);
65Assert.True(File.Exists(nugetConfigPath), "nuget.config should be created in working directory for in-place creation");
97Assert.True(File.Exists(nugetConfigPath), "nuget.config should exist in working directory");
99var content = await File.ReadAllTextAsync(nugetConfigPath);
135var parentContent = await File.ReadAllTextAsync(parentConfigPath);
141Assert.True(File.Exists(outputConfigPath), "nuget.config should be created in output directory");
143var outputContent = await File.ReadAllTextAsync(outputConfigPath);
177Assert.True(File.Exists(outputConfigPath), "nuget.config should exist in output directory");
179var content = await File.ReadAllTextAsync(outputConfigPath);
204Assert.False(File.Exists(workingConfigPath), "No nuget.config should be created in working directory");
208Assert.True(File.Exists(outputConfigPath), "nuget.config should be created in output directory");
210var content = await File.ReadAllTextAsync(outputConfigPath);
231Assert.False(File.Exists(workingConfigPath), "No nuget.config should be created for implicit channel");
232Assert.False(File.Exists(outputConfigPath), "No nuget.config should be created for implicit channel");
252Assert.False(File.Exists(workingConfigPath), "No nuget.config should be created when no mappings exist");
253Assert.False(File.Exists(outputConfigPath), "No nuget.config should be created when no mappings exist");
Templating\JavaAppHostTemplateTests.cs (14)
17var lines = File.ReadAllLines(GetJavaStarterAppHostPath());
29var lines = File.ReadAllLines(GetJavaStarterAppHostPath());
46Assert.True(File.Exists(path), $"Expected the java-starter VS Code settings at {path}");
48using var document = System.Text.Json.JsonDocument.Parse(File.ReadAllText(path));
68await Verify(File.ReadAllText(GetJavaStarterAppHostPath()), extension: "java");
84Assert.True(File.Exists(pomPath), $"Expected the java-starter API's Maven project at {pomPath}");
85Assert.Contains("spring-boot-starter-parent", File.ReadAllText(pomPath), StringComparison.Ordinal);
107using var document = System.Text.Json.JsonDocument.Parse(File.ReadAllText(path));
133Assert.True(File.Exists(path), $"Expected the java-starter Maven wrapper at {path}");
137Assert.True(File.Exists(propertiesPath), $"Expected the java-starter wrapper properties at {propertiesPath}");
138Assert.Contains("distributionType=only-script", File.ReadAllText(propertiesPath), StringComparison.Ordinal);
151var appHost = File.ReadAllText(GetJavaStarterAppHostPath());
154var viteConfig = File.ReadAllText(Path.Combine(GetJavaStarterDirectory(), "frontend", "vite.config.ts"));
161Assert.True(File.Exists(path), $"Expected the java-starter AppHost at {path}");
Templating\OutputPathHelperTests.cs (5)
36File.WriteAllText(Path.Combine(dir.FullName, "file.txt"), "content");
52File.WriteAllText(Path.Combine(dir.FullName, "file.txt"), "content");
67File.WriteAllText(Path.Combine(dir.FullName, "file.txt"), "content");
122File.WriteAllText(Path.Combine(dir.FullName, "file.txt"), "content");
159File.WriteAllText(Path.Combine(dir.FullName, "file.txt"), "content");
Templating\TemplateNuGetConfigServiceTests.cs (24)
30await File.WriteAllTextAsync(
114await File.WriteAllTextAsync(
124await File.WriteAllTextAsync(
179Assert.False(File.Exists(Path.Combine(workspace.WorkspaceRoot.FullName, "nuget.config")));
448File.WriteAllText(
647File.WriteAllText(Path.Combine(packagesDirectory.FullName, "Aspire.ProjectTemplates.13.5.0.nupkg"), string.Empty);
648File.WriteAllText(Path.Combine(prPackagesDirectory.FullName, "Aspire.ProjectTemplates.13.6.0-dev.nupkg"), string.Empty);
721File.WriteAllText(Path.Combine(packagesDirectory.FullName, "Aspire.ProjectTemplates.13.5.0.nupkg"), string.Empty);
722File.WriteAllText(Path.Combine(packagesDirectory.FullName, "Aspire.ProjectTemplates.13.6.0.nupkg"), string.Empty);
762File.WriteAllText(
800File.WriteAllText(Path.Combine(packagesDirectory.FullName, "Aspire.ProjectTemplates.13.6.0-dev.nupkg"), string.Empty);
801File.WriteAllText(Path.Combine(packagesDirectory.FullName, "Aspire.ProjectTemplates.99.0.0.nupkg"), string.Empty);
836File.WriteAllText(Path.Combine(packagesDirectory.FullName, "Aspire.ProjectTemplates.99.0.0.nupkg"), string.Empty);
877File.WriteAllText(Path.Combine(packagesDirectory.FullName, "Aspire.ProjectTemplates.13.6.0-dev.nupkg"), string.Empty);
878File.WriteAllText(Path.Combine(packagesDirectory.FullName, "Aspire.ProjectTemplates.13.7.0-dev.nupkg"), string.Empty);
978File.WriteAllText(Path.Combine(packagesDir.FullName, "Aspire.ProjectTemplates.13.5.0.nupkg"), string.Empty);
1035await File.WriteAllTextAsync(templatePackagePath, string.Empty);
1124Assert.True(File.Exists(configPath));
1161Assert.False(File.Exists(Path.Combine(outputDir.FullName, "nuget.config")));
1171await File.WriteAllTextAsync(
1207Assert.True(File.Exists(configPath));
1232await File.WriteAllTextAsync(
1267Assert.True(File.Exists(configPath));
1277Assert.False(File.Exists(configPath));
Utils\AppHostHelperTests.cs (26)
257File.WriteAllText(socket1, "");
258File.WriteAllText(socket2, "");
261File.WriteAllText(otherSocket, "");
283File.WriteAllText(oldFormatSocket, "");
286File.WriteAllText(legacyPidSocket, "");
310File.WriteAllText(badSeparator, "");
314File.WriteAllText(badPid, "");
333File.WriteAllText(otherSocket, "");
353File.WriteAllText(oldFormatSocket, "");
357File.WriteAllText(orphanedSocket, "");
361File.WriteAllText(liveSocket, "");
367Assert.True(File.Exists(oldFormatSocket), "Old format socket should still exist (can't detect orphan)");
368Assert.False(File.Exists(orphanedSocket), "Orphaned socket should be deleted");
369Assert.True(File.Exists(liveSocket), "Live socket should still exist");
393File.WriteAllText(orphanedSocket, "");
394File.WriteAllText(liveSocket, "");
395File.WriteAllText(pidlessSocket, "");
407Assert.False(File.Exists(orphanedSocket));
408Assert.True(File.Exists(liveSocket));
409Assert.True(File.Exists(pidlessSocket));
424File.WriteAllText(projectFileViaSymlink, "<Project />");
432File.WriteAllText(liveSocket, "");
461File.WriteAllText(realProjectPath, "<Project />");
570File.WriteAllText(socket, "");
601File.WriteAllText(socket, "");
631File.WriteAllText(legacySocket, "");
Utils\CliPathHelperTests.cs (19)
255File.WriteAllText(target, string.Empty);
258File.CreateSymbolicLink(link, target);
330File.WriteAllText(realPath, string.Empty);
333Assert.True(File.Exists(firmlinkedPath), "firmlinked /private/var path should resolve to the same physical file");
346File.WriteAllText(realPath, string.Empty);
385File.WriteAllText(binaryPath, string.Empty);
386File.WriteAllText(Path.Combine(binaryDir, InstallSidecarReader.SidecarFileName), $$"""{"source":"{{source}}"}""");
399File.WriteAllText(staleFile, string.Empty);
401File.WriteAllText(freshFile, string.Empty);
404File.SetLastWriteTimeUtc(staleFile, fakeTime.GetUtcNow().UtcDateTime - TimeSpan.FromHours(48));
405File.SetLastWriteTimeUtc(freshFile, fakeTime.GetUtcNow().UtcDateTime - TimeSpan.FromMinutes(5));
411Assert.False(File.Exists(staleFile));
412Assert.True(File.Exists(freshFile));
428File.WriteAllText(matching, string.Empty);
430File.WriteAllText(unrelated, string.Empty);
433File.SetLastWriteTimeUtc(matching, fakeTime.GetUtcNow().UtcDateTime - TimeSpan.FromHours(48));
434File.SetLastWriteTimeUtc(unrelated, fakeTime.GetUtcNow().UtcDateTime - TimeSpan.FromHours(48));
440Assert.False(File.Exists(matching));
441Assert.True(File.Exists(unrelated));
Utils\DevCertsCheckTests.cs (14)
69File.WriteAllText(certUtilPath, "");
72File.SetUnixFileMode(certUtilPath, UnixFileMode.UserRead | UnixFileMode.UserExecute);
101File.WriteAllText(openSslPath, contents);
104File.SetUnixFileMode(openSslPath, UnixFileMode.UserRead | UnixFileMode.UserExecute);
116File.WriteAllText(Path.Combine(trustDirectory.FullName, GetOpenSslCertificateFileName(certificate)), certificatePem);
117File.WriteAllText(Path.Combine(trustDirectory.FullName, hashEntryName), certificatePem);
557File.WriteAllText(Path.Combine(trustDirectory.FullName, GetOpenSslCertificateFileName(certificate)), certificate.ExportCertificatePem());
607File.WriteAllText(Path.Combine(trustDirectory.FullName, GetOpenSslCertificateFileName(certificate)), certificate.ExportCertificatePem());
666File.WriteAllText(Path.Combine(trustDirectory.FullName, GetOpenSslCertificateFileName(certificate)), certificate.ExportCertificatePem());
723File.WriteAllText(Path.Combine(trustDirectory.FullName, GetOpenSslCertificateFileName(certificate)), certificate.ExportCertificatePem());
854File.WriteAllText(Path.Combine(trustDirectory.FullName, corruptCertificateFileName), "not a certificate");
900File.WriteAllText(Path.Combine(trustDirectory.FullName, corruptCertificateFileName), "not a certificate");
946File.WriteAllText(Path.Combine(trustDirectory.FullName, "unrelated.pem"), "not a certificate");
989File.WriteAllText(Path.Combine(trustDirectory.FullName, GetOpenSslCertificateFileName(certificate)), staleCertificate.ExportCertificatePem());
Utils\FileSystemHelperTests.cs (38)
19File.WriteAllText(Path.Combine(sourceDir.FullName, "file1.txt"), "content1");
20File.WriteAllText(Path.Combine(sourceDir.FullName, "file2.txt"), "content2");
21File.WriteAllText(Path.Combine(sourceDir.FullName, "file3.cs"), "using System;");
28Assert.True(File.Exists(Path.Combine(destDir, "file1.txt")));
29Assert.True(File.Exists(Path.Combine(destDir, "file2.txt")));
30Assert.True(File.Exists(Path.Combine(destDir, "file3.cs")));
32Assert.Equal("content1", File.ReadAllText(Path.Combine(destDir, "file1.txt")));
33Assert.Equal("content2", File.ReadAllText(Path.Combine(destDir, "file2.txt")));
34Assert.Equal("using System;", File.ReadAllText(Path.Combine(destDir, "file3.cs")));
49File.WriteAllText(Path.Combine(sourceDir.FullName, "root.txt"), "root content");
50File.WriteAllText(Path.Combine(subDir1.FullName, "level1.txt"), "level 1 content");
51File.WriteAllText(Path.Combine(subDir2.FullName, "level2.txt"), "level 2 content");
58Assert.True(File.Exists(Path.Combine(destDir, "root.txt")));
60Assert.True(File.Exists(Path.Combine(destDir, "subdir1", "level1.txt")));
62Assert.True(File.Exists(Path.Combine(destDir, "subdir1", "subdir2", "level2.txt")));
64Assert.Equal("root content", File.ReadAllText(Path.Combine(destDir, "root.txt")));
65Assert.Equal("level 1 content", File.ReadAllText(Path.Combine(destDir, "subdir1", "level1.txt")));
66Assert.Equal("level 2 content", File.ReadAllText(Path.Combine(destDir, "subdir1", "subdir2", "level2.txt")));
159File.WriteAllBytes(binaryFilePath, randomBytes);
166Assert.True(File.Exists(copiedFilePath));
168var copiedBytes = File.ReadAllBytes(copiedFilePath);
185File.WriteAllText(Path.Combine(current.FullName, $"file{i}.txt"), $"content at level {i}");
198Assert.True(File.Exists(filePath));
199Assert.Equal($"content at level {i}", File.ReadAllText(filePath));
212File.WriteAllText(Path.Combine(sourceDir.FullName, "file1.txt"), "new content 1");
213File.WriteAllText(Path.Combine(sourceDir.FullName, "file2.txt"), "new content 2");
216File.WriteAllText(Path.Combine(subDir.FullName, "project.assets.json"), "new assets");
217File.WriteAllText(Path.Combine(subDir.FullName, "project.csproj.nuget.dgspec.json"), "new dgspec");
221File.WriteAllText(Path.Combine(destDir, "file1.txt"), "old content 1");
222File.WriteAllText(Path.Combine(destDir, "file2.txt"), "old content 2");
225File.WriteAllText(Path.Combine(destSubDir.FullName, "project.assets.json"), "old assets");
226File.WriteAllText(Path.Combine(destSubDir.FullName, "project.csproj.nuget.dgspec.json"), "old dgspec");
232Assert.Equal("new content 1", File.ReadAllText(Path.Combine(destDir, "file1.txt")));
233Assert.Equal("new content 2", File.ReadAllText(Path.Combine(destDir, "file2.txt")));
234Assert.Equal("new assets", File.ReadAllText(Path.Combine(destDir, "obj", "project.assets.json")));
235Assert.Equal("new dgspec", File.ReadAllText(Path.Combine(destDir, "obj", "project.csproj.nuget.dgspec.json")));
247File.WriteAllText(Path.Combine(sourceDir.FullName, "file1.txt"), "new content");
251File.WriteAllText(Path.Combine(destDir, "file1.txt"), "old content");
Utils\ReparsePointTests.cs (26)
18File.WriteAllText(Path.Combine(target, "marker"), "hello");
27Assert.Equal("hello", File.ReadAllText(Path.Combine(link, "marker")));
47File.WriteAllText(Path.Combine(target1, "id"), "one");
48File.WriteAllText(Path.Combine(target2, "id"), "two");
52Assert.Equal("one", File.ReadAllText(Path.Combine(link, "id")));
58Assert.Equal("two", File.ReadAllText(Path.Combine(link, "id")));
79File.WriteAllText(Path.Combine(real, "legacy"), "legacy");
90Assert.True(File.Exists(Path.Combine(real, "legacy")));
119File.WriteAllText(markerPath, "still here");
127Assert.True(File.Exists(markerPath));
136File.WriteAllText(Path.Combine(dir, "nested", "f"), "x");
212File.WriteAllText(Path.Combine(target, "marker"), "hello");
223Assert.Equal("hello", File.ReadAllText(Path.Combine(link, "marker")));
244File.WriteAllText(Path.Combine(nestedDir, "data.txt"), "payload");
256Assert.Equal("payload", File.ReadAllText(Path.Combine(nestedThroughLink, "data.txt")));
283File.WriteAllText(markerPath, "still here");
293Assert.True(File.Exists(markerPath));
352File.WriteAllText(Path.Combine(targetV1, "id"), "one");
353File.WriteAllText(Path.Combine(targetV2, "id"), "two");
362Assert.Equal("one", File.ReadAllText(Path.Combine(link, "id")));
372Assert.Equal("two", File.ReadAllText(Path.Combine(link, "id")));
382Assert.True(File.Exists(Path.Combine(targetV1, "id")));
432File.WriteAllText(Path.Combine(targetV1, "id"), "one");
433File.WriteAllText(Path.Combine(targetV2, "id"), "two");
453Assert.Equal("two", File.ReadAllText(Path.Combine(link, "id")));
456Assert.True(File.Exists(Path.Combine(targetV1, "id")));
Aspire.Dashboard (12)
Aspire.Dashboard.Components.Tests (1)
Aspire.Dashboard.Tests (36)
Model\DashboardDataSourceTests.cs (22)
67File.SetUnixFileMode(
77File.GetUnixFileMode(applicationDirectory));
114Assert.False(File.Exists(metadataPath));
123Assert.False(File.Exists(metadataPath));
127using var metadata = JsonDocument.Parse(File.ReadAllText(metadataPath));
150using var metadata = JsonDocument.Parse(File.ReadAllText(Path.Combine(currentRunStore.RunDirectory, "run.json")));
178Assert.False(File.Exists(Path.Combine(runStore.RunDirectory, "run.json")));
234Assert.True(File.Exists(databasePath));
238Assert.False(File.Exists(databasePath));
297File.WriteAllText(Path.Combine(abandonedDirectory, "dashboard.db"), string.Empty);
334File.WriteAllText(Path.Combine(otherDirectory, "dashboard.db"), string.Empty);
433Assert.False(File.Exists(databasePath));
458File.WriteAllBytes(databasePath, databaseContents);
459File.WriteAllBytes($"{databasePath}-wal", walContents);
460File.WriteAllBytes($"{databasePath}-shm", sharedMemoryContents);
464Assert.Equal(databaseContents, File.ReadAllBytes(databasePath));
465Assert.True(File.Exists($"{databasePath}-wal"));
466Assert.True(File.Exists($"{databasePath}-shm"));
659Assert.False(File.Exists(prunedRun.DatabasePath));
663Assert.All(selectableRuns, run => Assert.True(File.Exists(run.DatabasePath)));
692using var metadata = JsonDocument.Parse(File.ReadAllText(Path.Combine(pinnedRunDirectories[^1], "run.json")));
867using var metadata = JsonDocument.Parse(File.ReadAllText(Path.Combine(Path.GetDirectoryName(historicalRun.DatabasePath)!, "run.json")));
Aspire.Deployment.EndToEnd.Tests (145)
TypeScriptJavaScriptHostingDeploymentTests.cs (5)
124File.WriteAllText(Path.Combine(apiDir.FullName, "package.json"), """
134File.WriteAllText(Path.Combine(apiDir.FullName, "server.js"), """
145File.WriteAllText(Path.Combine(staticSiteDir.FullName, "package.json"), """
155File.WriteAllText(Path.Combine(staticSiteDir.FullName, "index.html"), """
168File.WriteAllText(Path.Combine(workspace.WorkspaceRoot.FullName, "apphost.mts"), """
Aspire.EndToEnd.Tests (18)
tests\Shared\TemplatesTesting\AspireProject.cs (9)
65File.WriteAllText(Path.Combine(dir, "Directory.Build.props"), "<Project />");
66File.WriteAllText(Path.Combine(dir, "Directory.Build.targets"), "<Project />");
73File.Copy(srcNuGetConfigPath, targetNuGetConfigPath);
107File.WriteAllText(Path.Combine(rootDir, "Directory.Build.props"), "<Project />");
108File.WriteAllText(Path.Combine(rootDir, "Directory.Build.targets"), "<Project />");
133var csprojContent = File.ReadAllText(csprojPath);
153File.Copy(Path.Combine(BuildEnvironment.TestAssetsPath, "EndPointWriterHook_cs"), Path.Combine(project.AppHostProjectDirectory, "EndPointWriterHook.cs"));
155string programCs = File.ReadAllText(programCsPath);
158File.WriteAllText(programCsPath, programCs);
Aspire.Hosting (104)
Aspire.Hosting.Azure (12)
Aspire.Hosting.Azure.Functions (5)
Aspire.Hosting.Azure.Kubernetes (4)
Aspire.Hosting.Azure.Kubernetes.Tests (6)
Aspire.Hosting.Azure.Tests (82)
AzureEnvironmentResourceTests.cs (22)
35Assert.True(File.Exists(mainBicepPath));
36var mainBicep = File.ReadAllText(mainBicepPath);
39Assert.True(File.Exists(envBicepPath));
40var envBicep = File.ReadAllText(envBicepPath);
72Assert.True(File.Exists(mainBicepPath));
73var mainBicep = File.ReadAllText(mainBicepPath);
123Assert.True(File.Exists(mainBicepPath));
124var content = File.ReadAllText(mainBicepPath);
170var mainBicep = File.ReadAllText(Path.Combine(workspace.FullName, "main.bicep"));
171var storageBicep = File.ReadAllText(Path.Combine(workspace.FullName, "storage", "storage.bicep"));
218var mainBicep = File.ReadAllText(Path.Combine(workspace.Path, "main.bicep"));
251Assert.True(File.Exists(mainBicepPath));
252var mainBicep = File.ReadAllText(mainBicepPath);
256Assert.True(File.Exists(includedStorageBicepPath), "Included storage should have a bicep file generated");
260Assert.False(File.Exists(excludedStorageBicepPath), "Excluded storage should not have a bicep file generated");
282Assert.True(File.Exists(dockerfilePath), $"Dockerfile should exist at {dockerfilePath}");
283var actualContent = await File.ReadAllTextAsync(dockerfilePath);
321await File.WriteAllTextAsync(bicepFilePath, bicepContent);
342Assert.True(File.Exists(mainBicepPath), "main.bicep should be generated");
345Assert.True(File.Exists(resourceBicepPath), "custom-resource/custom-resource.bicep should be generated");
348var copiedContent = await File.ReadAllTextAsync(resourceBicepPath);
352var mainBicepContent = await File.ReadAllTextAsync(mainBicepPath);
Aspire.Hosting.Blazor (8)
Aspire.Hosting.Blazor.Tests (17)
EndpointsManifestTransformerTests.cs (11)
39await File.WriteAllTextAsync(manifestPath, JsonSerializer.Serialize(manifest, ManifestJsonContext.Default.EndpointsManifest));
64await File.WriteAllTextAsync(manifestPath, JsonSerializer.Serialize(manifest, ManifestJsonContext.Default.EndpointsManifest));
95await File.WriteAllTextAsync(manifestPath, JsonSerializer.Serialize(manifest, ManifestJsonContext.Default.EndpointsManifest));
119await File.WriteAllTextAsync(manifestPath, JsonSerializer.Serialize(manifest, ManifestJsonContext.Default.EndpointsManifest));
177await File.WriteAllTextAsync(app1Path, JsonSerializer.Serialize(app1Manifest, ManifestJsonContext.Default.DevelopmentManifest));
178await File.WriteAllTextAsync(app2Path, JsonSerializer.Serialize(app2Manifest, ManifestJsonContext.Default.DevelopmentManifest));
194Assert.True(File.Exists(outputPath));
197await File.ReadAllTextAsync(outputPath),
241await File.WriteAllTextAsync(app1Path, JsonSerializer.Serialize(app1Manifest, ManifestJsonContext.Default.DevelopmentManifest));
242await File.WriteAllTextAsync(app2Path, JsonSerializer.Serialize(app2Manifest, ManifestJsonContext.Default.DevelopmentManifest));
259await File.ReadAllTextAsync(outputPath),
Aspire.Hosting.Browsers (17)
Aspire.Hosting.Browsers.Tests (36)
Aspire.Hosting.CodeGeneration.Go (2)
Aspire.Hosting.CodeGeneration.Java (1)
Aspire.Hosting.CodeGeneration.Java.Tests (5)
Aspire.Hosting.CodeGeneration.Python (3)
Aspire.Hosting.CodeGeneration.Rust (2)
Aspire.Hosting.CodeGeneration.Rust.Tests (6)
RustLanguageSupportTests.cs (5)
42File.WriteAllText(Path.Combine(workspace.Path, "apphost.rs"), "// marker");
43File.WriteAllText(Path.Combine(workspace.Path, "Cargo.toml"), "[package]");
57File.WriteAllText(Path.Combine(workspace.Path, "apphost.ts"), "// typescript");
58File.WriteAllText(Path.Combine(workspace.Path, "Cargo.toml"), "[package]");
70File.WriteAllText(Path.Combine(workspace.Path, "apphost.rs"), "// marker");
Aspire.Hosting.CodeGeneration.TypeScript (5)
Aspire.Hosting.CodeGeneration.TypeScript.Tests (6)
Aspire.Hosting.Containers.Tests (6)
Aspire.Hosting.Docker (11)
Aspire.Hosting.Docker.Tests (104)
DockerComposePublisherTests.cs (82)
102Assert.True(File.Exists(composePath));
103Assert.True(File.Exists(envPath));
105await Verify(File.ReadAllText(composePath), "yaml")
106.AppendContentAsFile(File.ReadAllText(envPath), "env");
139Assert.True(File.Exists(composePath));
140Assert.True(File.Exists(envPath));
142await Verify(File.ReadAllText(composePath), "yaml")
143.AppendContentAsFile(File.ReadAllText(envPath), "env");
166Assert.True(File.Exists(composePath));
168await Verify(File.ReadAllText(composePath), "yaml");
195Assert.True(File.Exists(composePath));
246Assert.True(File.Exists(composePath));
248Assert.True(File.Exists(envPath));
250await Verify(File.ReadAllText(composePath), "yaml")
251.AppendContentAsFile(File.ReadAllText(envPath), "env");
273Assert.True(File.Exists(envFilePath));
274var firstContent = File.ReadAllText(envFilePath).Replace("PARAM1=", "PARAM1=changed");
275File.WriteAllText(envFilePath, firstContent);
278Assert.True(File.Exists(envFilePath));
279var secondContent = File.ReadAllText(envFilePath);
314Assert.True(File.Exists(envFilePath));
315var firstContent = File.ReadAllText(envFilePath).Replace("PARAM1=", "PARAM1=changed");
316File.WriteAllText(envFilePath, firstContent);
319Assert.True(File.Exists(envFilePath));
320var secondContent = File.ReadAllText(envFilePath);
345Assert.True(File.Exists(composePath));
347var composeFile = File.ReadAllText(composePath);
371Assert.True(File.Exists(composePath));
373var composeContent = File.ReadAllText(composePath);
403Assert.True(File.Exists(composePath));
405var composeContent = File.ReadAllText(composePath);
434Assert.True(File.Exists(composePath));
436var composeContent = File.ReadAllText(composePath);
462Assert.True(File.Exists(composePath));
464var composeContent = File.ReadAllText(composePath);
488Assert.True(File.Exists(composePath));
490var composeContent = File.ReadAllText(composePath);
516Assert.True(File.Exists(composePath));
518var composeContent = File.ReadAllText(composePath);
548Assert.True(File.Exists(composePath));
550var composeContent = File.ReadAllText(composePath);
573Assert.True(File.Exists(dockerfilePath), $"Dockerfile should exist at {dockerfilePath}");
574var actualContent = await File.ReadAllTextAsync(dockerfilePath);
597Assert.False(File.Exists(composePath));
623var envFileContent = await File.ReadAllTextAsync(Path.Combine(workspace.Path, ".env.Production"));
653Assert.True(File.Exists(envFilePath), $"Expected env file at {envFilePath}");
655var envFileContent = await File.ReadAllTextAsync(envFilePath);
686var envFileContent = await File.ReadAllTextAsync(Path.Combine(workspace.Path, ".env.Production"));
709File.WriteAllText(envFilePath, "# Old content\nOLD_KEY=old_value\n");
715var envFileContent = File.ReadAllText(envFilePath);
743File.WriteAllText(envFilePath, "# Old staging content\nOLD_STAGING_KEY=old_staging_value\n");
749var envFileContent = File.ReadAllText(envFilePath);
775var composeContent = await File.ReadAllTextAsync(Path.Combine(workspace.Path, "docker-compose.yaml"));
776var envFileContent = await File.ReadAllTextAsync(Path.Combine(workspace.Path, ".env.Production"));
808var envFileContent = await File.ReadAllTextAsync(Path.Combine(workspace.Path, ".env.Production"));
834var envFileContent = await File.ReadAllTextAsync(Path.Combine(workspace.Path, ".env.Production"));
861Assert.True(File.Exists(composePath));
862Assert.True(File.Exists(envPath));
864await Verify(File.ReadAllText(composePath), "yaml")
865.AppendContentAsFile(File.ReadAllText(envPath), "env");
887Assert.True(File.Exists(composePath));
889var composeContent = File.ReadAllText(composePath);
919Assert.True(File.Exists(composePath));
920Assert.True(File.Exists(envPath));
922await Verify(File.ReadAllText(composePath), "yaml")
923.AppendContentAsFile(File.ReadAllText(envPath), "env");
958Assert.True(File.Exists(composePath));
959Assert.True(File.Exists(envPath));
961await Verify(File.ReadAllText(composePath), "yaml")
962.AppendContentAsFile(File.ReadAllText(envPath), "env");
1006Assert.True(File.Exists(composePath));
1007Assert.True(File.Exists(envPath));
1009await Verify(File.ReadAllText(composePath), "yaml")
1010.AppendContentAsFile(File.ReadAllText(envPath), "env");
1040Assert.True(File.Exists(composePath));
1041Assert.True(File.Exists(envPath));
1043await Verify(File.ReadAllText(composePath), "yaml")
1044.AppendContentAsFile(File.ReadAllText(envPath), "env");
1083Assert.True(File.Exists(composePath));
1085await Verify(File.ReadAllText(composePath), "yaml");
1117Assert.True(File.Exists(composePath));
1119await Verify(File.ReadAllText(composePath), "yaml");
Aspire.Hosting.Dotnet (9)
Aspire.Hosting.Dotnet.Tests (12)
DotnetProjectResourceTests.cs (12)
165Assert.False(File.Exists(Path.Combine(workspace.Path, "aspire-manifest.json")));
398await File.WriteAllTextAsync(Path.Combine(workspace.Path, "Dockerfile"), "FROM scratch");
434File.WriteAllText(projectPath, "<Project />");
451File.WriteAllText(Path.Combine(projectDir.FullName, "First.csproj"), "<Project />");
452File.WriteAllText(Path.Combine(projectDir.FullName, "Second.csproj"), "<Project />");
478await File.WriteAllTextAsync(projectPath, "<Project />");
481await File.WriteAllTextAsync(Path.Combine(propertiesDir.FullName, "launchSettings.json"), """
565await File.WriteAllTextAsync(projectPath, "<Project />");
568await File.WriteAllTextAsync(Path.Combine(propertiesDir.FullName, "launchSettings.json"), """
635await File.WriteAllTextAsync(projectPath, "<Project />");
638await File.WriteAllTextAsync(Path.Combine(propertiesDir.FullName, "launchSettings.json"), """
939File.WriteAllText(path, string.Empty);
Aspire.Hosting.Garnet.Tests (1)
Aspire.Hosting.Go (5)
Aspire.Hosting.Go.Tests (33)
AddGoAppTests.cs (28)
88File.WriteAllText(Path.Combine(sourceDir.FullName, "go.mod"), "module example.com/api\n\ngo 1.24\n");
95var content = await File.ReadAllTextAsync(Path.Combine(outputDir.FullName, "api.Dockerfile"));
779File.WriteAllText(Path.Combine(sourceDir.FullName, "go.mod"), "module example.com/api\n\ngo 1.23\n");
780File.WriteAllText(Path.Combine(sourceDir.FullName, "main.go"), "package main\nfunc main() {}");
788Assert.True(File.Exists(dockerfilePath), "Dockerfile should be generated in publish mode");
790var content = await File.ReadAllTextAsync(dockerfilePath);
807var content = await File.ReadAllTextAsync(Path.Combine(outputDir.FullName, "api.Dockerfile"));
819File.WriteAllText(Path.Combine(sourceDir.FullName, "go.mod"), "module example.com/api\n\ngo 1.22\n");
829var content = await File.ReadAllTextAsync(Path.Combine(outputDir.FullName, "api.Dockerfile"));
841File.WriteAllText(Path.Combine(sourceDir.FullName, "go.mod"), "module example.com/api\n\ngo 1.24\n");
851var content = await File.ReadAllTextAsync(Path.Combine(outputDir.FullName, "api.Dockerfile"));
864File.WriteAllText(Path.Combine(sourceDir.FullName, "Dockerfile"), "FROM scratch");
880File.WriteAllText(Path.Combine(sourceDir.FullName, "go.mod"), "module example.com/api\n\ngo 1.22\n");
888var content = await File.ReadAllTextAsync(Path.Combine(outputDir.FullName, "api.Dockerfile"));
902File.WriteAllText(Path.Combine(sourceDir.FullName, "go.mod"), "module example.com/api\n\ngo 1.24\n");
910var content = await File.ReadAllTextAsync(Path.Combine(outputDir.FullName, "api.Dockerfile"));
922File.WriteAllText(Path.Combine(sourceDir.FullName, "go.mod"), "module example.com/api\n\ngo 1.24\n");
930var content = await File.ReadAllTextAsync(Path.Combine(outputDir.FullName, "api.Dockerfile"));
978File.WriteAllText(Path.Combine(sourceDir.FullName, "go.mod"), "module example.com/api\n\ngo 1.24\n");
995var dockerfile = await File.ReadAllTextAsync(Path.Combine(outputDir.FullName, "api.Dockerfile"));
1012File.WriteAllText(Path.Combine(sourceDir.FullName, "go.mod"), "module example.com/api\n\ngo 1.24\n");
1035var dockerfile = await File.ReadAllTextAsync(Path.Combine(outputDir.FullName, "api.Dockerfile"));
1080File.WriteAllText(Path.Combine(sourceDir.FullName, "go.mod"), "module example.com/api\n\ngo 1.24\n");
1087var content = await File.ReadAllTextAsync(Path.Combine(outputDir.FullName, "api.Dockerfile"));
1154File.WriteAllText(Path.Combine(sourceDir.FullName, "go.mod"), "module example.com/api\n\ngo 1.24\n");
1161var content = await File.ReadAllTextAsync(Path.Combine(outputDir.FullName, "api.Dockerfile"));
1173File.WriteAllText(Path.Combine(sourceDir.FullName, "go.mod"), "module example.com/api\n\ngo 1.24\n");
1181var content = await File.ReadAllTextAsync(Path.Combine(outputDir.FullName, "api.Dockerfile"));
GoVersionDetectorTests.cs (5)
22File.WriteAllText(Path.Combine(workspace.Path, "go.mod"), "module example.com/m\n\ngo 1.23\n");
33File.WriteAllText(Path.Combine(workspace.Path, "go.mod"), "module example.com/m\n\ngo 1.23.4\n");
44File.WriteAllText(Path.Combine(workspace.Path, "go.mod"),
57File.WriteAllText(Path.Combine(workspace.Path, "go.mod"),
69File.WriteAllText(Path.Combine(workspace.Path, "go.mod"), "module example.com/m\n");
Aspire.Hosting.Java (28)
Aspire.Hosting.Java.Tests (77)
AddJavaAppPublishTests.cs (55)
52await File.WriteAllTextAsync(Path.Combine(workspace.Path, "build", "libs", "reports service.jar"), "");
68Assert.True(File.Exists(destination));
234File.WriteAllText(Path.Combine(sourceDir.FullName, "build.gradle"), "");
395File.WriteAllText(Path.Combine(source, ".dockerignore"), "secrets/\n");
410File.WriteAllText(Path.Combine(sourceDir.FullName, "Dockerfile"), "FROM scratch\n");
416Assert.False(File.Exists(Path.Combine(outputDir.FullName, "api.Dockerfile")));
431File.WriteAllText(Path.Combine(sourceDir.FullName, "Dockerfile"), "FROM scratch\n");
462File.WriteAllText(Path.Combine(sourceDir.FullName, "Dockerfile"), "FROM scratch\n");
494var manifest = await File.ReadAllTextAsync(Path.Combine(outputDir.FullName, "aspire-manifest.json"), TestContext.Current.CancellationToken);
511File.WriteAllText(Path.Combine(appDirectory.Path, "pom.xml"), $"""
532File.WriteAllText(Path.Combine(appDirectory.Path, "pom.xml"), """
562File.WriteAllText(Path.Combine(appDirectory.Path, "pom.xml"), """
640File.WriteAllText(Path.Combine(appDirectory.Path, "build.gradle"), script);
650File.WriteAllText(Path.Combine(appDirectory.Path, "pom.xml"), """
653File.WriteAllText(Path.Combine(appDirectory.Path, "build.gradle"), "sourceCompatibility = '21'");
669File.WriteAllText(Path.Combine(appDirectory.Path, "pom.xml"), """
672File.WriteAllText(Path.Combine(appDirectory.Path, "build.gradle"), "sourceCompatibility = '21'");
686File.WriteAllText(Path.Combine(appDirectory.Path, "pom.xml"), """
689File.WriteAllText(Path.Combine(appDirectory.Path, "build.gradle"), "plugins { id 'java' }");
701File.WriteAllText(Path.Combine(appDirectory.Path, "pom.xml"), """
724File.WriteAllText(Path.Combine(appDirectory.Path, "pom.xml"), """
746File.WriteAllText(Path.Combine(appDirectory.Path, "pom.xml"), """
767File.WriteAllText(Path.Combine(appDirectory.Path, "pom.xml"), "<project>");
799File.WriteAllText(Path.Combine(appDirectory.Path, fileName), "");
816File.WriteAllText(Path.Combine(appDirectory.Path, "pom.xml"), "<project />");
817File.WriteAllText(Path.Combine(appDirectory.Path, "build.gradle"), "");
863File.WriteAllText(Path.Combine(sourceDir.FullName, "pom.xml"), "<project/>");
1012File.Delete(Path.Combine(sourceDir.FullName, "mvnw"));
1078File.WriteAllText(Path.Combine(source, "target", "worker.jar"), "");
1098File.WriteAllText(Path.Combine(source, "target", "worker.jar"), "");
1114File.WriteAllText(Path.Combine(source, "target", "worker.jar"), "");
1147await File.WriteAllTextAsync(
1178await File.ReadAllTextAsync(Path.Combine(outputDir.FullName, "aspire-manifest.json"), TestContext.Current.CancellationToken));
1187File.Copy(
1190File.Copy(
1227await File.WriteAllTextAsync(
1260await File.WriteAllTextAsync(
1294File.Copy(
1297File.Copy(
1472Assert.Equal("runner", File.ReadAllText(Path.Combine(stagingDirectory, "quarkus-run.jar")));
1481Assert.Equal("dependency", File.ReadAllText(expectedDependency));
1531File.AppendAllText(
1694File.WriteAllText(
1696File.ReadAllText(Path.Combine(source, "pom.xml")).Replace(
1779File.Exists(Path.Combine(outputDir.FullName, "api.Dockerfile")),
1805return await File.ReadAllTextAsync(Path.Combine(outputDir.FullName, "api.Dockerfile"), TestContext.Current.CancellationToken);
2028return await File.ReadAllTextAsync(Path.Combine(outputDir.FullName, "api.Dockerfile"), TestContext.Current.CancellationToken);
2054return File.Exists(ignorePath)
2055? await File.ReadAllTextAsync(ignorePath, TestContext.Current.CancellationToken)
2063File.WriteAllText(Path.Combine(sourceDirectory, "pom.xml"), $"""
2080File.WriteAllText(Path.Combine(sourceDirectory, "pom.xml"), $"""
2097File.WriteAllText(Path.Combine(sourceDirectory, "pom.xml"), $"""
2125File.WriteAllText(Path.Combine(sourceDirectory, "build.gradle"), contents);
2131File.WriteAllText(Path.Combine(sourceDirectory, wrapperName), "#!/bin/sh\nexit 0\n");
2148File.WriteAllText(
AddJavaAppTests.cs (13)
351File.WriteAllText(Path.Combine(repo.Path, "settings.gradle"), "include 'services:api'");
353File.WriteAllText(Path.Combine(module, "build.gradle"), "");
371File.WriteAllText(Path.Combine(repo.Path, "pom.xml"), "<project />");
373File.WriteAllText(Path.Combine(module, "pom.xml"), "<project />");
392File.WriteAllText(Path.Combine(module, JavaHostingExtensions.s_defaultGradleWrapper), "#!/bin/sh\n");
781File.WriteAllText(customWrapper, "#!/bin/sh\n");
816await File.WriteAllTextAsync(wrapper, "#!/bin/sh\nexit 0\n");
819File.SetUnixFileMode(wrapper, UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.GroupRead | UnixFileMode.OtherRead);
1575File.WriteAllText(
1684File.WriteAllText(Path.Combine(tempDir.Path, "pom.xml"), """
1714File.WriteAllText(Path.Combine(tempDir.Path, "settings.gradle"), "rootProject.name = 'orders'\n");
1747File.WriteAllText(
1769File.WriteAllText(Path.Combine(tempDir.Path, "pom.xml"), """
Aspire.Hosting.JavaScript (30)
JavaScriptHostingExtensions.cs (26)
177if (File.Exists(Path.Combine(resource.WorkingDirectory, "Dockerfile")))
281if (File.Exists(Path.Combine(appDirectory, "package.json")))
520if (File.Exists(Path.Combine(resource.WorkingDirectory, "Dockerfile")))
706if (File.Exists(Path.Combine(appDirectory, "package.json")))
1170if (File.Exists(Path.Combine(appDirectory, "Dockerfile")))
1545if (File.Exists(candidatePath))
1589File.WriteAllText(aspireConfigPath, aspireConfig);
1850var hasBunLock = File.Exists(Path.Combine(workingDirectory, "bun.lock")) ||
1851File.Exists(Path.Combine(workingDirectory, "bun.lockb"));
1856if (File.Exists(Path.Combine(workingDirectory, "bun.lock")))
1860if (File.Exists(Path.Combine(workingDirectory, "bun.lockb")))
1900File.Exists(Path.Combine(resource.Resource.WorkingDirectory, "package-lock.json"))
1918var hasYarnLock = File.Exists(Path.Combine(workingDirectory, "yarn.lock"));
1919var hasYarnrc = File.Exists(Path.Combine(workingDirectory, ".yarnrc.yml"));
1997var hasPnpmLock = File.Exists(Path.Combine(workingDirectory, "pnpm-lock.yaml"));
1998var hasPnpmWorkspace = File.Exists(Path.Combine(workingDirectory, "pnpm-workspace.yaml"));
2053if (!File.Exists(packageJsonPath))
2060using var packageJson = JsonDocument.Parse(File.ReadAllText(packageJsonPath));
2442if (!File.Exists(configPath))
2449var content = File.ReadAllText(configPath);
2567if (File.Exists(nvmrcPath))
2569var versionString = File.ReadAllText(nvmrcPath).Trim();
2580if (File.Exists(nodeVersionPath))
2582var versionString = File.ReadAllText(nodeVersionPath).Trim();
2593if (File.Exists(toolVersionsPath))
2595var lines = File.ReadAllLines(toolVersionsPath);
Aspire.Hosting.JavaScript.Tests (132)
AddBunAppTests.cs (17)
41File.WriteAllText(Path.Combine(appDir, "package.json"), "{}");
49var dockerfileContents = File.ReadAllText(dockerfilePath);
66File.WriteAllText(Path.Combine(appDir, "package.json"), "{}");
75await Verify(File.ReadAllText(Path.Combine(workspace.Path, "js.Dockerfile")));
86File.WriteAllText(Path.Combine(appDir, "package.json"), "{}");
96Assert.True(File.Exists(perDockerfileIgnorePath), $"Expected per-Dockerfile dockerignore at {perDockerfileIgnorePath}");
97var ignoreContents = File.ReadAllText(perDockerfileIgnorePath);
101Assert.False(File.Exists(Path.Combine(appDir, ".dockerignore")), "Aspire should not write a .dockerignore into the user's source tree.");
117File.WriteAllText(Path.Combine(appDir, "package.json"), "{}");
124Assert.True(File.Exists(perDockerfileIgnorePath));
131File.WriteAllText(userIgnorePath, userIgnoreContents);
135Assert.False(File.Exists(perDockerfileIgnorePath), "Aspire should not shadow a user-authored context-root .dockerignore.");
138Assert.Equal(userIgnoreContents, File.ReadAllText(userIgnorePath));
145File.WriteAllText(Path.Combine(workspace.Path, "server.ts"), "console.log('hi');");
167File.WriteAllText(Path.Combine(workspace.Path, "package.json"), "{}");
351File.WriteAllText(Path.Combine(workspace.Path, "package.json"), "{}");
384File.WriteAllText(Path.Combine(workspace.Path, "package.json"), "{}");
AddJavaScriptAppTests.cs (30)
37await Verify(File.ReadAllText(dockerfilePath));
60await Verify(File.ReadAllText(dockerfilePath));
80await Verify(File.ReadAllText(dockerfilePath));
100await Verify(File.ReadAllText(dockerfilePath));
117File.WriteAllText(Path.Combine(appDir, "pnpm-lock.yaml"), string.Empty);
127var dockerfileContents = File.ReadAllText(dockerfilePath);
147var dockerfileLines = await File.ReadAllLinesAsync(Path.Combine(workspace.Path, "js.Dockerfile"));
177File.WriteAllText(Path.Combine(appDir, "pnpm-lock.yaml"), string.Empty);
188var dockerfileContents = File.ReadAllText(dockerfilePath);
353File.WriteAllText(Path.Combine(appDir, "pnpm-workspace.yaml"), "allowBuilds: {}\n");
362var dockerfileLines = await File.ReadAllLinesAsync(dockerfilePath);
383await File.WriteAllTextAsync(
397var dockerfile = await File.ReadAllTextAsync(Path.Combine(workspace.Path, "js.Dockerfile"));
417await File.WriteAllTextAsync(
432var dockerfile = await File.ReadAllTextAsync(Path.Combine(workspace.Path, "js.Dockerfile"));
449await File.WriteAllTextAsync(
463var dockerfile = await File.ReadAllTextAsync(Path.Combine(workspace.Path, "js.Dockerfile"));
478await File.WriteAllTextAsync(
492var dockerfile = await File.ReadAllTextAsync(Path.Combine(workspace.Path, "js.Dockerfile"));
518File.WriteAllText(
556await File.WriteAllTextAsync(Path.Combine(appDir, "package.json"), packageJson);
565Assert.True(File.Exists(dockerfilePath), $"Dockerfile should exist at {dockerfilePath}");
568var dockerfileContent = await File.ReadAllTextAsync(dockerfilePath);
580await File.WriteAllTextAsync(dockerfileInContext, modifiedDockerfile);
651await File.WriteAllTextAsync(Path.Combine(appDir, "package.json"), packageJson);
661Assert.True(File.Exists(dockerfilePath), $"Dockerfile should exist at {dockerfilePath}");
663var dockerfileContent = await File.ReadAllTextAsync(dockerfilePath);
670await File.WriteAllTextAsync(dockerfileInContext, dockerfileContent);
725File.WriteAllText(Path.Combine(appDir, "Dockerfile"), dockerfile);
726File.WriteAllText(Path.Combine(appDir, "package.json"), """
AddNodeAppTests.cs (18)
106File.WriteAllText(Path.Combine(appDir, "package.json"), "{}");
107File.WriteAllText(Path.Combine(appDir, "package-lock.json"), "{}");
115var dockerfileContents = File.ReadAllText(dockerfilePath);
171File.WriteAllText(Path.Combine(appDir, "package.json"), "{}");
184var dockerfileContents = File.ReadAllText(dockerfilePath);
218File.WriteAllText(Path.Combine(appDir, "package.json"), "{}");
229var dockerfileContents = File.ReadAllText(Path.Combine(workspace.Path, "js.Dockerfile"));
238File.WriteAllText(Path.Combine(workspace.Path, "app.js"), "{}");
265File.WriteAllText(Path.Combine(workspace.Path, "package.json"), "{}");
339File.WriteAllText(Path.Combine(appDirectory, "package.json"), packageJsonContent);
340File.WriteAllText(Path.Combine(appDirectory, "app.js"), appContent);
366Assert.True(File.Exists(nodeDockerfilePath), "Dockerfile should be generated for NodeApp");
368var dockerfileContent = File.ReadAllText(nodeDockerfilePath);
396File.WriteAllText(Path.Combine(appDirectory, "package.json"), packageJsonContent);
397File.WriteAllText(Path.Combine(appDirectory, "app.js"), appContent);
423Assert.True(File.Exists(nodeDockerfilePath), "Dockerfile should be generated for NodeApp");
425var dockerfileContent = File.ReadAllText(nodeDockerfilePath);
562File.WriteAllText(Path.Combine(workspace.Path, "app.js"), "console.log('hello');");
AddViteAppTests.cs (55)
32File.WriteAllText(Path.Combine(viteDir, "package-lock.json"), "empty");
64var dockerfileContents = File.ReadAllText(dockerfilePath);
91File.WriteAllText(Path.Combine(viteDir, "package-lock.json"), "empty");
100await Verify(File.ReadAllText(dockerfilePath));
117File.WriteAllText(Path.Combine(viteDir, "package-lock.json"), "empty");
121File.WriteAllText(Path.Combine(apiDir, "package-lock.json"), "empty");
133await Verify(File.ReadAllText(dockerfilePath));
144File.WriteAllText(Path.Combine(viteDir, "package-lock.json"), "empty");
165File.WriteAllText(Path.Combine(viteDir, "package-lock.json"), "empty");
169File.WriteAllText(Path.Combine(apiDir, "package-lock.json"), "empty");
195File.WriteAllText(Path.Combine(appDir, "package-lock.json"), "empty");
204await Verify(File.ReadAllText(dockerfilePath));
221File.WriteAllText(Path.Combine(appDir, "package-lock.json"), "empty");
230await Verify(File.ReadAllText(dockerfilePath));
244File.WriteAllText(Path.Combine(nextDir, "package-lock.json"), "empty");
252await Verify(File.ReadAllText(dockerfilePath));
265File.WriteAllText(Path.Combine(nextDir, "pnpm-lock.yaml"), "");
273await Verify(File.ReadAllText(dockerfilePath));
284File.WriteAllText(Path.Combine(appDir, "pnpm-lock.yaml"), "");
293await Verify(File.ReadAllText(dockerfilePath));
304File.WriteAllText(Path.Combine(appDir, "bun.lock"), "");
313await Verify(File.ReadAllText(dockerfilePath));
322File.WriteAllText(Path.Combine(workspace.Path, ".nvmrc"), "18.20.0");
330var dockerfileContents = File.ReadAllText(Path.Combine(workspace.Path, "vite.Dockerfile"));
342File.WriteAllText(Path.Combine(workspace.Path, ".node-version"), "v21.5.0");
350var dockerfileContents = File.ReadAllText(Path.Combine(workspace.Path, "vite.Dockerfile"));
367File.WriteAllText(Path.Combine(workspace.Path, ".tool-versions"), toolVersions);
375var dockerfileContents = File.ReadAllText(Path.Combine(workspace.Path, "vite.Dockerfile"));
393File.WriteAllText(Path.Combine(workspace.Path, ".tool-versions"), toolVersions);
401var dockerfileContents = File.ReadAllText(Path.Combine(workspace.Path, "vite.Dockerfile"));
419File.WriteAllText(Path.Combine(workspace.Path, "package.json"), packageJson);
427var dockerfileContents = File.ReadAllText(Path.Combine(workspace.Path, "vite.Dockerfile"));
444var dockerfileContents = File.ReadAllText(Path.Combine(workspace.Path, "vite.Dockerfile"));
460File.WriteAllText(Path.Combine(workspace.Path, ".nvmrc"), versionString);
468var dockerfileContents = File.ReadAllText(Path.Combine(workspace.Path, "vite.Dockerfile"));
490var dockerfileContents = File.ReadAllText(Path.Combine(workspace.Path, "vite.Dockerfile"));
552File.WriteAllText(viteConfigPath, "export default {}");
613File.WriteAllText(viteConfigPath, "export default {}");
714File.WriteAllText(viteConfigPath, "export default {}");
760File.WriteAllText(viteConfigPath, "export default {}");
818File.WriteAllText(viteConfigPath, "export default {}");
872var wrapperContent = File.ReadAllText(wrapperFiles[0]);
896File.WriteAllText(firstConfigPath, "export default { app: 'a' }");
897File.WriteAllText(secondConfigPath, "export default { app: 'b' }");
941Assert.Contains(Path.GetFullPath(firstConfigPath).Replace("\\", "\\\\"), File.ReadAllText(firstWrapperPath));
942Assert.Contains(Path.GetFullPath(secondConfigPath).Replace("\\", "\\\\"), File.ReadAllText(secondWrapperPath));
959File.WriteAllText(firstConfigPath, "export default { app: 'first' }");
960File.WriteAllText(secondConfigPath, "export default { app: 'second' }");
980Assert.Contains(Path.GetFullPath(firstConfigPath).Replace("\\", "\\\\"), File.ReadAllText(firstWrapperPath));
981Assert.Contains(Path.GetFullPath(secondConfigPath).Replace("\\", "\\\\"), File.ReadAllText(secondWrapperPath));
1000File.WriteAllText(viteConfigPath, "export default {}");
1052File.WriteAllText(Path.Combine(nextDir, "package-lock.json"), "empty");
1068File.WriteAllText(Path.Combine(nextDir, "package-lock.json"), "empty");
1085File.WriteAllText(Path.Combine(nextDir, "package-lock.json"), "empty");
1086File.WriteAllText(Path.Combine(nextDir, "next.config.ts"), "const nextConfig = {}; export default nextConfig;");
PackageInstallationTests.cs (7)
458File.WriteAllText(Path.Combine(workspace.Path, "package-lock.json"), "empty");
485File.WriteAllText(Path.Combine(workspace.Path, "yarn.lock"), "empty");
506File.WriteAllText(Path.Combine(workspace.Path, "yarn.lock"), "empty");
507File.WriteAllText(Path.Combine(workspace.Path, ".yarnrc.yml"), "empty");
522File.WriteAllText(Path.Combine(workspace.Path, "yarn.lock"), "empty");
538File.WriteAllText(Path.Combine(workspace.Path, "pnpm-lock.yaml"), "empty");
553File.WriteAllText(Path.Combine(workspace.Path, "bun.lock"), "empty");
Aspire.Hosting.Kafka.Tests (1)
Aspire.Hosting.Keycloak.Tests (1)
Aspire.Hosting.Kubernetes (14)
KubernetesEnvironmentResource.cs (7)
1476await File.WriteAllTextAsync(patchFilePath, patchJson, context.CancellationToken).ConfigureAwait(false);
1589await File.WriteAllTextAsync(certPath, certPem, context.CancellationToken).ConfigureAwait(false);
1590await File.WriteAllTextAsync(keyPath, keyPem, context.CancellationToken).ConfigureAwait(false);
1922await File.WriteAllTextAsync(patchFilePath, patchJson, context.CancellationToken).ConfigureAwait(false);
2103await File.WriteAllTextAsync(manifestPath, minimal.ToJsonString(), context.CancellationToken).ConfigureAwait(false);
2226await File.WriteAllTextAsync(certPath, certPem, context.CancellationToken).ConfigureAwait(false);
2227await File.WriteAllTextAsync(keyPath, keyPem, context.CancellationToken).ConfigureAwait(false);
Aspire.Hosting.Kubernetes.Tests (144)
KubernetesDeployTests.cs (37)
878var chartYaml = await File.ReadAllTextAsync(Path.Combine(workspace.Path, "Chart.yaml"));
909var chartYaml = await File.ReadAllTextAsync(Path.Combine(workspace.Path, "Chart.yaml"));
931var deploymentYaml = await File.ReadAllTextAsync(Path.Combine(workspace.Path, "templates", "svc", "deployment.yaml"));
983await File.WriteAllTextAsync(Path.Combine(outputPath, "values.yaml"), valuesYaml);
1003Assert.True(File.Exists(deployValuesPath), "values.env.yaml should be created");
1005var content = await File.ReadAllTextAsync(deployValuesPath);
1022await File.WriteAllTextAsync(Path.Combine(outputPath, "values.yaml"), "parameters: {}\nsecrets: {}\nconfig: {}");
1032Assert.False(File.Exists(deployValuesPath), "values.env.yaml should not be created when there are no captured values");
1042await File.WriteAllTextAsync(Path.Combine(outputPath, "values.yaml"), "parameters: {}\nsecrets: {}\nconfig: {}");
1062Assert.True(File.Exists(deployValuesPath));
1064var content = await File.ReadAllTextAsync(deployValuesPath);
1116await File.WriteAllTextAsync(Path.Combine(outputPath, "values.yaml"), "parameters: {}\nsecrets: {}\nconfig: {}");
1138Assert.True(File.Exists(deployValuesPath));
1140var content = await File.ReadAllTextAsync(deployValuesPath);
1281await File.WriteAllTextAsync(Path.Combine(outputPath, "values.yaml"), valuesYaml);
1307Assert.True(File.Exists(deployValuesPath), "values.env.yaml should be created");
1309var content = await File.ReadAllTextAsync(deployValuesPath);
1331Assert.False(File.Exists(deployValuesPath));
1370Assert.True(File.Exists(valuesPath), "values.yaml should exist");
1371var valuesContent = await File.ReadAllTextAsync(valuesPath);
1393if (File.Exists(serverSecretsTemplatePath))
1395var templateContent = await File.ReadAllTextAsync(serverSecretsTemplatePath);
1445Assert.True(File.Exists(valuesPath), "values.yaml should exist");
1446var valuesContent = await File.ReadAllTextAsync(valuesPath);
1504Assert.True(File.Exists(overridePath), "Override file should be created");
1506var content = await File.ReadAllTextAsync(overridePath);
1562Assert.True(File.Exists(overridePath), "Override file should be created");
1564var content = await File.ReadAllTextAsync(overridePath);
1623await Verify(await File.ReadAllTextAsync(overridePath), "yaml");
1668await Verify(await File.ReadAllTextAsync(overridePath), "yaml");
1708await Verify(await File.ReadAllTextAsync(Path.Combine(workspace.Path, "values.yaml")), "yaml")
1710await File.ReadAllTextAsync(Path.Combine(workspace.Path, "templates", "myapp", "config.yaml")),
1712.AppendContentAsFile(await File.ReadAllTextAsync(overridePath), "yaml");
1781Assert.True(File.Exists(valuesPath));
1782var content = await File.ReadAllTextAsync(valuesPath);
1816Assert.True(File.Exists(valuesPath));
1817var content = await File.ReadAllTextAsync(valuesPath);
KubernetesIngressTests.cs (26)
35Assert.True(File.Exists(ingressPath), $"Expected ingress YAML at {ingressPath}");
37var content = await File.ReadAllTextAsync(ingressPath);
65Assert.True(File.Exists(ingressPath), $"Expected ingress YAML at {ingressPath}");
67var content = await File.ReadAllTextAsync(ingressPath);
109Assert.True(File.Exists(ingressPath), $"Expected ingress YAML at {ingressPath}");
111var content = await File.ReadAllTextAsync(ingressPath);
116Assert.True(File.Exists(valuesPath), $"Expected values.yaml at {valuesPath}");
118var values = await File.ReadAllTextAsync(valuesPath);
150var content = await File.ReadAllTextAsync(ingressPath);
180await Verify(File.ReadAllText(ingressPath), "yaml")
181.AppendContentAsFile(File.ReadAllText(valuesPath), "yaml");
206await Verify(File.ReadAllText(ingressPath), "yaml");
230await Verify(File.ReadAllText(ingressPath), "yaml");
254var content = await File.ReadAllTextAsync(ingressPath);
283var content = await File.ReadAllTextAsync(ingressPath);
316var content = await File.ReadAllTextAsync(ingressPath);
344var content = await File.ReadAllTextAsync(ingressPath);
368var content = await File.ReadAllTextAsync(ingressPath);
615Assert.True(File.Exists(publicPath), $"Public ingress YAML not found at {publicPath}");
616Assert.True(File.Exists(internalPath), $"Internal ingress YAML not found at {internalPath}");
618var publicContent = await File.ReadAllTextAsync(publicPath);
619var internalContent = await File.ReadAllTextAsync(internalPath);
648Assert.True(File.Exists(ingressPath), $"Expected ingress YAML at {ingressPath}");
650var content = await File.ReadAllTextAsync(ingressPath);
683var content = await File.ReadAllTextAsync(ingressPath);
799Assert.True(File.Exists(ingressPath));
KubernetesPublisherTests.cs (66)
76settingsTask = Verify(File.ReadAllText(filePath), fileExtension);
80settingsTask = settingsTask.AppendContentAsFile(File.ReadAllText(filePath), fileExtension);
111Assert.True(File.Exists(deploymentPath));
113var content = await File.ReadAllTextAsync(deploymentPath);
173settingsTask = Verify(File.ReadAllText(filePath), fileExtension);
177settingsTask = settingsTask.AppendContentAsFile(File.ReadAllText(filePath), fileExtension);
213Assert.True(File.Exists(manifestPath), $"Manifest should exist at {manifestPath}");
215var content = await File.ReadAllTextAsync(manifestPath);
295settingsTask = Verify(File.ReadAllText(filePath), fileExtension);
299settingsTask = settingsTask.AppendContentAsFile(File.ReadAllText(filePath), fileExtension);
351settingsTask = Verify(File.ReadAllText(filePath), fileExtension);
355settingsTask = settingsTask.AppendContentAsFile(File.ReadAllText(filePath), fileExtension);
379Assert.True(File.Exists(dockerfilePath), $"Dockerfile should exist at {dockerfilePath}");
380var actualContent = await File.ReadAllTextAsync(dockerfilePath);
454var deployment = await File.ReadAllTextAsync(deploymentPath);
547var deployment = await File.ReadAllTextAsync(deploymentPath);
647settingsTask = Verify(File.ReadAllText(filePath), fileExtension);
651settingsTask = settingsTask.AppendContentAsFile(File.ReadAllText(filePath), fileExtension);
692settingsTask = Verify(File.ReadAllText(filePath), fileExtension);
696settingsTask = settingsTask.AppendContentAsFile(File.ReadAllText(filePath), fileExtension);
715await Verify(File.ReadAllText(servicePath), "yaml");
754settingsTask = Verify(File.ReadAllText(filePath), fileExtension);
758settingsTask = settingsTask.AppendContentAsFile(File.ReadAllText(filePath), fileExtension);
806settingsTask = Verify(File.ReadAllText(filePath), fileExtension);
810settingsTask = settingsTask.AppendContentAsFile(File.ReadAllText(filePath), fileExtension);
851settingsTask = Verify(File.ReadAllText(filePath), fileExtension);
855settingsTask = settingsTask.AppendContentAsFile(File.ReadAllText(filePath), fileExtension);
897settingsTask = Verify(File.ReadAllText(filePath), fileExtension);
901settingsTask = settingsTask.AppendContentAsFile(File.ReadAllText(filePath), fileExtension);
1052settingsTask = Verify(File.ReadAllText(filePath), fileExtension);
1056settingsTask = settingsTask.AppendContentAsFile(File.ReadAllText(filePath), fileExtension);
1098settingsTask = Verify(File.ReadAllText(filePath), fileExtension);
1102settingsTask = settingsTask.AppendContentAsFile(File.ReadAllText(filePath), fileExtension);
1159settingsTask = Verify(File.ReadAllText(filePath), fileExtension);
1163settingsTask = settingsTask.AppendContentAsFile(File.ReadAllText(filePath), fileExtension);
1210settingsTask = Verify(File.ReadAllText(filePath), fileExtension);
1214settingsTask = settingsTask.AppendContentAsFile(File.ReadAllText(filePath), fileExtension);
1272settingsTask = Verify(File.ReadAllText(filePath), fileExtension);
1276settingsTask = settingsTask.AppendContentAsFile(File.ReadAllText(filePath), fileExtension);
1331settingsTask = Verify(File.ReadAllText(filePath), fileExtension);
1335settingsTask = settingsTask.AppendContentAsFile(File.ReadAllText(filePath), fileExtension);
1385settingsTask = Verify(File.ReadAllText(filePath), fileExtension);
1389settingsTask = settingsTask.AppendContentAsFile(File.ReadAllText(filePath), fileExtension);
1438Assert.True(File.Exists(filePath), $"Expected publisher to emit {expectedFile}.");
1440var content = await File.ReadAllTextAsync(filePath);
1457Assert.False(File.Exists(legacyPv), "DefaultStorageType=\"pvc\" must not emit a bare PV; dynamic provisioning is driven by the PVC's storageClassName.");
1487Assert.True(File.Exists(deploymentPath));
1489var deploymentContent = await File.ReadAllTextAsync(deploymentPath);
1532Assert.True(File.Exists(filePath), $"Expected publisher to emit {expectedFile}.");
1534var content = await File.ReadAllTextAsync(filePath);
1545Assert.False(File.Exists(legacyPvc), "Bound volumes must not also be emitted via the env-default PV/PVC path.");
1549Assert.False(File.Exists(deploymentPath), "Workloads bound to a persistent volume must render as a StatefulSet, not a Deployment.");
1587Assert.True(File.Exists(filePath), $"Expected publisher to emit {expectedFile}.");
1589var content = await File.ReadAllTextAsync(filePath);
1623var content = await File.ReadAllTextAsync(statefulSetPath);
1650var content = await File.ReadAllTextAsync(statefulSetPath);
1690Assert.True(File.Exists(statefulSetPath));
1692var statefulSetContent = await File.ReadAllTextAsync(statefulSetPath);
1696Assert.True(File.Exists(pvcPath));
1697var pvcContent = await File.ReadAllTextAsync(pvcPath);
1760Assert.True(File.Exists(statefulSetPath), $"Expected StatefulSet manifest at {statefulSetPath}");
1761var content = await File.ReadAllTextAsync(statefulSetPath);
1834Assert.True(File.Exists(pvcPath), $"Expected PVC manifest at {pvcPath}");
1835var pvcContent = await File.ReadAllTextAsync(pvcPath);
1846Assert.True(File.Exists(valuesPath), $"Expected values.yaml at {valuesPath}");
1847var valuesContent = await File.ReadAllTextAsync(valuesPath);
Aspire.Hosting.Maui (6)
Aspire.Hosting.Maui.Tests (53)
MauiPlatformExtensionsTests.cs (27)
95File.WriteAllText(tempFile, MauiTestHelper.CreateProjectContent(config.RequiredTfm));
118File.WriteAllText(tempFile, MauiTestHelper.CreateProjectContent(config.RequiredTfm));
138File.WriteAllText(tempFile, MauiTestHelper.CreateProjectContent(config.RequiredTfm));
157File.WriteAllText(tempFile, MauiTestHelper.CreateProjectContent(config.RequiredTfm));
186File.WriteAllText(tempFile, MauiTestHelper.CreateProjectContent(config.RequiredTfm));
234File.WriteAllText(tempFile, MauiTestHelper.CreateProjectContent(config.RequiredTfm));
253File.WriteAllText(tempFile, MauiTestHelper.CreateProjectContent(config.RequiredTfm));
277File.WriteAllText(tempFile, CreateProjectContentWithout(config.PlatformIdentifier));
305File.WriteAllText(tempFile, MauiTestHelper.CreateProjectContent("net10.0-android"));
331File.WriteAllText(tempFile, MauiTestHelper.CreateProjectContent("net10.0-android"));
354File.WriteAllText(tempFile, MauiTestHelper.CreateProjectContent("net10.0-android"));
377File.WriteAllText(tempFile, MauiTestHelper.CreateProjectContent("net10.0-android"));
400File.WriteAllText(tempFile, MauiTestHelper.CreateProjectContent("net10.0-ios"));
428File.WriteAllText(tempFile, MauiTestHelper.CreateProjectContent("net10.0-ios"));
453File.WriteAllText(tempFile, MauiTestHelper.CreateProjectContent("net10.0-ios"));
482File.WriteAllText(tempFile, MauiTestHelper.CreateProjectContent("net10.0-ios"));
507File.WriteAllText(tempFile, MauiTestHelper.CreateProjectContent("net10.0-ios"));
534File.WriteAllText(tempFile, MauiTestHelper.CreateProjectContent("net10.0-ios"));
562File.WriteAllText(tempFile, MauiTestHelper.CreateProjectContent("net10.0-android"));
592File.WriteAllText(tempFile, MauiTestHelper.CreateProjectContent(config.RequiredTfm));
616File.WriteAllText(tempFile, MauiTestHelper.CreateProjectContent(config.RequiredTfm));
639File.WriteAllText(tempFile, MauiTestHelper.CreateProjectContent(config.RequiredTfm));
677File.WriteAllText(tempFile, MauiTestHelper.CreateProjectContent("net10.0-ios"));
729File.WriteAllText(tempFile, MauiTestHelper.CreateProjectContent("net10.0-android"));
793File.WriteAllText(tempFile, MauiTestHelper.CreateProjectContent("net10.0-android"));
817File.WriteAllText(tempFile, MauiTestHelper.CreateProjectContent("net10.0-android"));
844File.WriteAllText(tempFile, MauiTestHelper.CreateProjectContent("net10.0-android"));
MauiWithArgsTests.cs (11)
21File.WriteAllText(tempFile, MauiTestHelper.CreateProjectContent(windowsTfm));
39File.WriteAllText(tempFile, MauiTestHelper.CreateProjectContent("net10.0-maccatalyst"));
58File.WriteAllText(tempFile, MauiTestHelper.CreateProjectContent("net10.0-android"));
78File.WriteAllText(tempFile, MauiTestHelper.CreateProjectContent("net10.0-android"));
95File.WriteAllText(tempFile, MauiTestHelper.CreateProjectContent("net10.0-android"));
115File.WriteAllText(tempFile, MauiTestHelper.CreateProjectContent("net10.0-android"));
132File.WriteAllText(tempFile, MauiTestHelper.CreateProjectContent("net10.0-ios"));
151File.WriteAllText(tempFile, MauiTestHelper.CreateProjectContent("net10.0-ios"));
168File.WriteAllText(tempFile, MauiTestHelper.CreateProjectContent("net10.0-ios"));
188File.WriteAllText(tempFile, MauiTestHelper.CreateProjectContent("net10.0-ios"));
210File.WriteAllText(tempFile, """
Aspire.Hosting.MongoDB.Tests (4)
Aspire.Hosting.MySql (2)
Aspire.Hosting.MySql.Tests (4)
Aspire.Hosting.Oracle.Tests (4)
Aspire.Hosting.PostgreSQL.Tests (3)
Aspire.Hosting.Python (15)
Aspire.Hosting.Python.Tests (82)
AddPythonAppTests.cs (77)
290File.WriteAllText(scriptPath, scriptContent);
293File.WriteAllText(requirementsPath, requirementsContent);
297File.WriteAllText(dockerFilePath,
1269File.WriteAllText(Path.Combine(projectDirectory, "pyproject.toml"), pyprojectContent);
1270File.WriteAllText(Path.Combine(projectDirectory, "uv.lock"), uvLockContent);
1271File.WriteAllText(Path.Combine(projectDirectory, "main.py"), scriptContent);
1293Assert.True(File.Exists(scriptDockerfilePath), "Dockerfile should be generated for script entrypoint");
1296Assert.True(File.Exists(moduleDockerfilePath), "Dockerfile should be generated for module entrypoint");
1299Assert.True(File.Exists(executableDockerfilePath), "Dockerfile should be generated for executable entrypoint");
1301var scriptDockerfileContent = File.ReadAllText(scriptDockerfilePath);
1302var moduleDockerfileContent = File.ReadAllText(moduleDockerfilePath);
1303var executableDockerfileContent = File.ReadAllText(executableDockerfilePath);
1335File.WriteAllText(Path.Combine(projectDirectory, "pyproject.toml"), pyprojectContent);
1337File.WriteAllText(Path.Combine(projectDirectory, "main.py"), scriptContent);
1359Assert.True(File.Exists(scriptDockerfilePath), "Dockerfile should be generated for script entrypoint");
1362Assert.True(File.Exists(moduleDockerfilePath), "Dockerfile should be generated for module entrypoint");
1365Assert.True(File.Exists(executableDockerfilePath), "Dockerfile should be generated for executable entrypoint");
1367var scriptDockerfileContent = File.ReadAllText(scriptDockerfilePath);
1368var moduleDockerfileContent = File.ReadAllText(moduleDockerfilePath);
1369var executableDockerfileContent = File.ReadAllText(executableDockerfilePath);
1795File.WriteAllText(Path.Combine(projectDirectory, "pyproject.toml"), pyprojectContent);
1796File.WriteAllText(Path.Combine(projectDirectory, "uv.lock"), uvLockContent);
1797File.WriteAllText(Path.Combine(projectDirectory, "main.py"), scriptContent);
1813Assert.True(File.Exists(dockerfilePath), "Dockerfile should be generated");
1815var dockerfileContent = File.ReadAllText(dockerfilePath);
1842File.WriteAllText(Path.Combine(projectDirectory, "requirements.txt"), requirementsContent);
1843File.WriteAllText(Path.Combine(projectDirectory, "main.py"), scriptContent);
1855Assert.True(File.Exists(dockerfilePath), "Dockerfile should be generated for non-UV Python app");
1857var dockerfileContent = File.ReadAllText(dockerfilePath);
1892File.WriteAllText(Path.Combine(projectDirectory, "main.py"), scriptContent);
1893File.WriteAllText(Path.Combine(projectDirectory, "pyproject.toml"), pyprojectContent);
1905Assert.True(File.Exists(dockerfilePath), "Dockerfile should be generated for non-UV Python app");
1907var dockerfileContent = File.ReadAllText(dockerfilePath);
1925File.WriteAllText(Path.Combine(projectDirectory, "main.py"), scriptContent);
1937Assert.True(File.Exists(dockerfilePath), "Dockerfile should be generated for Python app");
1939var dockerfileContent = File.ReadAllText(dockerfilePath);
1959File.WriteAllText(Path.Combine(projectDirectory, "main.py"), scriptContent);
1960File.WriteAllText(Path.Combine(projectDirectory, ".python-version"), pythonVersionContent);
1974Assert.True(File.Exists(scriptDockerfilePath), "Dockerfile should be generated for script entrypoint");
1977Assert.True(File.Exists(moduleDockerfilePath), "Dockerfile should be generated for module entrypoint");
1980Assert.True(File.Exists(executableDockerfilePath), "Dockerfile should be generated for executable entrypoint");
1982var scriptDockerfileContent = File.ReadAllText(scriptDockerfilePath);
1983var moduleDockerfileContent = File.ReadAllText(moduleDockerfilePath);
1984var executableDockerfileContent = File.ReadAllText(executableDockerfilePath);
2009File.WriteAllText(scriptPath, "print('Hello')");
2013File.WriteAllText(pyprojectPath, "[project]\nname = \"test\"");
2043File.WriteAllText(scriptPath, "print('Hello')");
2047File.WriteAllText(requirementsPath, "requests==2.31.0");
2078File.WriteAllText(scriptPath, "print('Hello')");
2082File.WriteAllText(pyprojectPath, "[project]\nname = \"test\"");
2084File.WriteAllText(requirementsPath, "requests==2.31.0");
2108File.WriteAllText(scriptPath, "print('Hello')");
2132File.WriteAllText(scriptPath, "print('Hello')");
2155File.WriteAllText(scriptPath, "print('Hello')");
2159File.WriteAllText(requirementsPath, "requests");
2183File.WriteAllText(scriptPath, "print('Hello')");
2187File.WriteAllText(requirementsPath, "requests");
2212File.WriteAllText(scriptPath, "print('Hello')");
2240File.WriteAllText(scriptPath, "print('Hello')");
2244File.WriteAllText(requirementsPath, "requests");
2283File.WriteAllText(scriptPath, "print('Hello')");
2286File.WriteAllText(requirementsPath, "requests");
2313File.WriteAllText(scriptPath, "print('Hello')");
2316File.WriteAllText(requirementsPath, "requests");
2347File.WriteAllText(scriptPath, "print('Hello')");
2350File.WriteAllText(requirementsPath, "requests");
2383File.WriteAllText(scriptPath, "print('Hello')");
2386File.WriteAllText(requirementsPath, "requests");
2413File.WriteAllText(scriptPath, "print('Hello')");
2416File.WriteAllText(requirementsPath, "requests");
2445File.WriteAllText(scriptPath, "print('Hello')");
2448File.WriteAllText(requirementsPath, "requests");
2477File.WriteAllText(scriptPath, "print('Hello')");
2480File.WriteAllText(requirementsPath, "requests");
2513File.WriteAllText(scriptPath, "print('Hello')");
2567File.WriteAllText(scriptPath, "print('Hello')");
2570File.WriteAllText(requirementsPath, "requests");
Aspire.Hosting.Radius (10)
Aspire.Hosting.Radius.Tests (15)
Aspire.Hosting.Redis.Tests (1)
Aspire.Hosting.RemoteHost (13)
Aspire.Hosting.RemoteHost.Tests (48)
LayoutCommandTests.cs (28)
28await File.WriteAllTextAsync(Path.Combine(packageRoot, "lib", "net10.0", "Test.Package.dll"), "base");
29await File.WriteAllTextAsync(Path.Combine(packageRoot, "runtimes", "unix", "lib", "net10.0", "Test.Package.dll"), "unix");
30await File.WriteAllTextAsync(Path.Combine(packageRoot, "runtimes", "win", "lib", "net10.0", "Test.Package.dll"), "win");
31await File.WriteAllTextAsync(Path.Combine(packageRoot, "lib", "net10.0", "fr", "Test.Package.resources.dll"), "fr");
32await File.WriteAllTextAsync(Path.Combine(packageRoot, "runtimes", GetCurrentRuntimeIdentifier(), "native", GetNativeFileName()), "runtime-native");
35await File.WriteAllTextAsync(assetsPath, CreateAssetsJsonWithResolvedRidTarget(workspaceRoot, GetCurrentRuntimeIdentifier(), GetNativeFileName()));
49Assert.Equal(GetExpectedRuntimeContent(), await File.ReadAllTextAsync(Path.Combine(outputPath, "Test.Package.dll")));
50Assert.Equal("fr", await File.ReadAllTextAsync(Path.Combine(outputPath, "fr", "Test.Package.resources.dll")));
51Assert.Equal("runtime-native", await File.ReadAllTextAsync(Path.Combine(outputPath, GetNativeFileName())));
54await File.ReadAllTextAsync(Path.Combine(outputPath, "runtimes", GetExpectedRuntimeAssetRid(), "lib", "net10.0", "Test.Package.dll")));
57await File.ReadAllTextAsync(Path.Combine(outputPath, "runtimes", GetCurrentRuntimeIdentifier(), "native", GetNativeFileName())));
80await File.WriteAllTextAsync(Path.Combine(packageRoot, "lib", "net10.0", "Test.Package.dll"), "base");
81await File.WriteAllTextAsync(Path.Combine(packageRoot, "runtimes", "unix", "lib", "net10.0", "Test.Package.dll"), "unix");
82await File.WriteAllTextAsync(Path.Combine(packageRoot, "runtimes", "win", "lib", "net10.0", "Test.Package.dll"), "win");
85await File.WriteAllTextAsync(assetsPath, CreateAssetsJsonWithRuntimeSpecificTarget(workspaceRoot, GetCurrentRuntimeIdentifier(), GetExpectedRuntimeAssemblyPath()));
99Assert.Equal(GetExpectedRuntimeContent(), await File.ReadAllTextAsync(Path.Combine(outputPath, "Test.Package.dll")));
120await File.WriteAllTextAsync(Path.Combine(packageRoot, "lib", "net10.0", "Test.Package.dll"), "base");
123await File.WriteAllTextAsync(assetsPath, CreateAssetsJsonWithBaseTargetOnly(workspaceRoot));
137Assert.Equal("base", await File.ReadAllTextAsync(Path.Combine(outputPath, "Test.Package.dll")));
161await File.WriteAllTextAsync(Path.Combine(packageRoot, "lib", "net10.0", "Test.Package.dll"), "base");
162await File.WriteAllTextAsync(Path.Combine(packageRoot, "runtimes", "unix", "lib", "net10.0", "Test.Package.dll"), "unix");
163await File.WriteAllTextAsync(Path.Combine(packageRoot, "runtimes", "win", "lib", "net10.0", "Test.Package.dll"), "win");
164await File.WriteAllTextAsync(Path.Combine(packageRoot, "lib", "net10.0", "fr", "Test.Package.resources.dll"), "fr");
165await File.WriteAllTextAsync(Path.Combine(packageRoot, "runtimes", GetCurrentRuntimeIdentifier(), "native", GetNativeFileName()), "runtime-native");
168await File.WriteAllTextAsync(assetsPath, CreateAssetsJsonWithResolvedRidTarget(workspaceRoot, GetCurrentRuntimeIdentifier(), GetNativeFileName()));
184await using var manifestStream = File.OpenRead(outputPath);
256await using var manifestStream = File.OpenRead(manifestPath);
416using var stream = File.OpenRead(assetsPath);
Aspire.Hosting.Rust (8)
Aspire.Hosting.Rust.Tests (58)
AddRustAppPublishTests.cs (43)
40File.WriteAllText(Path.Combine(source, "rust-toolchain.toml"), """
418Assert.False(File.Exists(Path.Combine(outputDir.FullName, "api.Dockerfile")));
473Assert.False(File.Exists(Path.Combine(outputDir.FullName, "api.Dockerfile")));
497File.WriteAllText(Path.Combine(sourceDir.FullName, "Dockerfile"), "FROM scratch\n");
503Assert.False(File.Exists(Path.Combine(outputDir.FullName, "api.Dockerfile")));
515File.WriteAllText(Path.Combine(sourceDir.FullName, "Dockerfile"), "FROM scratch\n");
521Assert.False(File.Exists(Path.Combine(outputDir.FullName, "api.Dockerfile")));
533File.WriteAllText(customDockerfile, "FROM scratch\n");
545Assert.False(File.Exists(Path.Combine(outputDir.FullName, "api.Dockerfile")));
565var content = await File.ReadAllTextAsync(
591File.WriteAllText(Path.Combine(manifestDirectory.FullName, "Cargo.toml"), "[package]\nname = \"api\"\n");
594if (!File.Exists(Path.Combine(sourceDir.FullName, differentlyCasedPath)))
604var content = await File.ReadAllTextAsync(Path.Combine(outputDir.FullName, "api.Dockerfile"), TestContext.Current.CancellationToken);
619File.WriteAllText(Path.Combine(manifestDirectory.FullName, "Cargo.toml"), "[package]\nname = \"api\"\n");
622if (!File.Exists(Path.Combine(sourceDir.FullName, composedManifestPath)))
634var content = await File.ReadAllTextAsync(Path.Combine(outputDir.FullName, "api.Dockerfile"), TestContext.Current.CancellationToken);
655File.WriteAllText(Path.Combine(manifestDirectory.FullName, "Cargo.toml"), "[package]\nname = \"api\"\n");
657var originalMode = File.GetUnixFileMode(restrictedAncestor.FullName);
662File.SetUnixFileMode(restrictedAncestor.FullName, UnixFileMode.UserExecute);
678var content = await File.ReadAllTextAsync(
686File.SetUnixFileMode(restrictedAncestor.FullName, originalMode);
718File.WriteAllText(Path.Combine(manifestDirectory.FullName, "Cargo.toml"), "[package]\nname = \"api\"\n");
754var content = await File.ReadAllTextAsync(Path.Combine(outputDir.FullName, "api.Dockerfile"), TestContext.Current.CancellationToken);
773File.WriteAllText(Path.Combine(manifestDirectory.FullName, "Cargo.toml"), "[package]\nname = \"api\"\n");
781if (!File.Exists(differentlyCasedCanonicalManifest))
793var content = await File.ReadAllTextAsync(Path.Combine(outputDir.FullName, "api.Dockerfile"), TestContext.Current.CancellationToken);
805File.WriteAllText(Path.Combine(outsideDir.FullName, "Cargo.toml"), "[package]\nname = \"outside\"\n");
813Assert.False(File.Exists(Path.Combine(outputDir.FullName, "api.Dockerfile")));
836Assert.False(File.Exists(Path.Combine(outputDir.FullName, "api.Dockerfile")));
874File.WriteAllText(Path.Combine(source, "Cargo.lock"), "version = 4\n"));
883configureSource: source => File.WriteAllText(Path.Combine(source, "Cargo.lock"), "version = 4\n"),
927var first = await File.ReadAllTextAsync(Path.Combine(firstOutputDir.FullName, "api.Dockerfile"), TestContext.Current.CancellationToken);
928var second = await File.ReadAllTextAsync(Path.Combine(secondOutputDir.FullName, "api.Dockerfile"), TestContext.Current.CancellationToken);
945var first = await File.ReadAllTextAsync(Path.Combine(outputDir.FullName, "api.Dockerfile"), TestContext.Current.CancellationToken);
946var second = await File.ReadAllTextAsync(Path.Combine(outputDir.FullName, "worker.Dockerfile"), TestContext.Current.CancellationToken);
974var ignore = await File.ReadAllTextAsync(Path.Combine(outputDir.FullName, "api.Dockerfile.dockerignore"), TestContext.Current.CancellationToken);
988File.WriteAllText(Path.Combine(sourceDir.FullName, ".dockerignore"), "*.md\n");
995Assert.False(File.Exists(Path.Combine(outputDir.FullName, "api.Dockerfile.dockerignore")));
1010File.WriteAllText(Path.Combine(relocatedDir.FullName, "Dockerfile"), "FROM scratch\n");
1053File.WriteAllText(Path.Combine(workspace.WorkspaceRoot.FullName, "Cargo.lock"), "version = 4\n");
1057File.WriteAllText(Path.Combine(sourceDir.FullName, "Cargo.lock"), "version = 4\n");
1066var content = await File.ReadAllTextAsync(Path.Combine(outputDir.FullName, "api.Dockerfile"), TestContext.Current.CancellationToken);
1143return await File.ReadAllTextAsync(Path.Combine(outputDir.FullName, "api.Dockerfile"), TestContext.Current.CancellationToken);
Aspire.Hosting.Sdk.Tests (62)
AppHostSdkTargetsTests.cs (61)
224await File.WriteAllTextAsync(nonExecutableDnxPath, "");
227File.SetUnixFileMode(nonExecutableDnxPath, UnixFileMode.UserRead | UnixFileMode.UserWrite);
352await File.WriteAllTextAsync(appHostFile, """
451await File.ReadAllLinesAsync(captureFile));
452Assert.False(File.Exists(shadowCaptureFile), "The working-directory Aspire shim was invoked instead of the resolved PATH command.");
492await File.ReadAllLinesAsync(captureFile));
493Assert.False(File.Exists(shadowCaptureFile), "The working-directory DNX shim was invoked instead of the resolved PATH command.");
530await File.ReadAllLinesAsync(captureFile));
569await File.ReadAllLinesAsync(captureFile));
789await File.WriteAllTextAsync(commandShimPath, """
797await File.WriteAllTextAsync(projectPath, $$"""
830Assert.True(File.Exists(childPidPath), $"The child process did not record its PID. MSBuild output:{Environment.NewLine}{result.Output}");
832childProcessId = int.Parse(await File.ReadAllTextAsync(childPidPath), CultureInfo.InvariantCulture);
855await File.WriteAllTextAsync(
862File.SetUnixFileMode(commandPath, UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute);
1074await File.WriteAllTextAsync(Path.Combine(projectDirectory, "AppHost.csproj"),
1104return await File.ReadAllLinesAsync(packageReferencesPath);
1126await File.WriteAllTextAsync(projectFile,
1149await File.WriteAllTextAsync(Path.Combine(projectDirectory, "Program.cs"), """
1225await File.WriteAllTextAsync(aspirePath, """
1233File.SetUnixFileMode(aspirePath, UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute);
1261await File.WriteAllTextAsync(aspirePath, contents.ReplaceLineEndings(OperatingSystem.IsWindows() ? "\r\n" : "\n"));
1264File.SetUnixFileMode(aspirePath, UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute);
1275File.WriteAllText(Path.Combine(bundle.DcpDirectory, OperatingSystem.IsWindows() ? "dcp.exe" : "dcp"), "");
1276File.WriteAllText(bundle.ManagedPath, "");
1295await File.WriteAllTextAsync(aspirePath, """
1312await File.WriteAllTextAsync(aspirePath, ("""
1320File.SetUnixFileMode(aspirePath, UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute);
1332await File.WriteAllTextAsync(Path.Combine(fakeSdkDirectory.FullName, "dotnet.dll"), "");
1335await File.WriteAllTextAsync(dnxPath, OperatingSystem.IsWindows()
1370File.SetUnixFileMode(dnxPath, UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute);
1381await File.WriteAllTextAsync(Path.Combine(fakeCliDirectory, "fail-version"), "");
1385await File.WriteAllTextAsync(dnxPath, ("""
1389File.SetUnixFileMode(dnxPath, UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute);
1396File.Copy(fakeDotNetPath, aspirePath, overwrite: true);
1406File.Copy(sourcePath, Path.Combine(destinationDirectory, Path.GetFileName(sourcePath)), overwrite: true);
1417await File.WriteAllTextAsync(
1433await File.WriteAllTextAsync(Path.Combine(fakeCliDirectory, "aspire.cmd"), $$"""
1446await File.WriteAllTextAsync(aspirePath, ($$"""
1454File.SetUnixFileMode(aspirePath, UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute);
1461await File.WriteAllTextAsync(Path.Combine(fakeCliDirectory, "aspire.cmd"), $$"""
1475await File.WriteAllTextAsync(aspirePath, ($$"""
1488File.SetUnixFileMode(aspirePath, UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute);
1495await File.WriteAllTextAsync(Path.Combine(fakeCliDirectory, "aspire.cmd"), """
1509await File.WriteAllTextAsync(aspirePath, ("""
1518File.SetUnixFileMode(aspirePath, UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute);
1525await File.WriteAllTextAsync(Path.Combine(fakeCliDirectory, "aspire.cmd"), """
1543await File.WriteAllTextAsync(aspirePath, ("""
1556File.SetUnixFileMode(aspirePath, UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute);
1563await File.WriteAllTextAsync(Path.Combine(fakeCliDirectory, "aspire.cmd"), """
1580await File.WriteAllTextAsync(aspirePath, ("""
1587File.SetUnixFileMode(aspirePath, UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute);
1614Assert.True(File.Exists(toolPath), $"Aspire.RuntimeIdentifier.Tool was not built at '{toolPath}'. Build the test project to produce it.");
1626Assert.True(File.Exists(taskAssemblyPath), $"Aspire.Hosting.Tasks was not built at '{taskAssemblyPath}'. Build the test project to produce it.");
1637if (!File.Exists(vswherePath))
1655.FirstOrDefault(File.Exists);
1665Assert.True(File.Exists(path), $"The file specified by {metadataName} was not built at '{path}'.");
1755File.Exists(Path.Combine(aspireHome, "bundle", "dcp", OperatingSystem.IsWindows() ? "dcp.exe" : "dcp")),
1758File.Exists(Path.Combine(aspireHome, "bundle", "managed", OperatingSystem.IsWindows() ? "aspire-managed.exe" : "aspire-managed")),
1807return executableNames.Any(executableName => File.Exists(Path.Combine(directory.Trim().Trim('"'), executableName)));
1916while (directory is not null && !Directory.Exists(Path.Combine(directory, ".git")) && !File.Exists(Path.Combine(directory, ".git")))
Aspire.Hosting.SqlServer.Tests (1)
Aspire.Hosting.Tasks (10)
Aspire.Hosting.Testing (2)
Aspire.Hosting.Testing.Tests (6)
Aspire.Hosting.Tests (309)
ApplicationModel\Docker\DockerfileBuildAnnotationTests.cs (24)
88Assert.False(File.Exists(dockerfilePath));
92if (File.Exists(dockerfilePath))
94File.Delete(dockerfilePath);
122Assert.True(File.Exists(dockerfilePath));
123var actualContent = await File.ReadAllTextAsync(dockerfilePath);
128if (File.Exists(dockerfilePath))
130File.Delete(dockerfilePath);
164Assert.True(File.Exists(dockerfilePath));
168if (File.Exists(dockerfilePath))
170File.Delete(dockerfilePath);
207Assert.True(File.Exists(dockerfilePath));
211if (File.Exists(dockerfilePath))
213File.Delete(dockerfilePath);
224await File.WriteAllTextAsync(dockerfilePath, "FROM scratch");
226if (!File.Exists(differentCasingDockerfilePath))
235Assert.Equal("FROM scratch", await File.ReadAllTextAsync(dockerfilePath));
248await File.WriteAllTextAsync(dockerfilePath, "FROM scratch");
259Assert.Equal(generatedIgnoreContent, await File.ReadAllTextAsync(perDockerfileIgnore));
261await File.WriteAllTextAsync(Path.Combine(contextPath, ".dockerignore"), "secrets\n");
265Assert.False(File.Exists(perDockerfileIgnore));
278await File.WriteAllTextAsync(dockerfilePath, "FROM scratch");
279await File.WriteAllTextAsync(Path.Combine(contextPath, ".dockerignore"), "secrets\n");
283await File.WriteAllTextAsync(perDockerfileIgnore, userIgnoreContent);
292Assert.Equal(userIgnoreContent, await File.ReadAllTextAsync(perDockerfileIgnore));
Dashboard\DashboardEventHandlersTests.cs (19)
565File.Delete(tempDir);
574File.WriteAllText(dashboardDll, "mock dll content");
597File.WriteAllText(runtimeConfig, JsonSerializer.Serialize(originalConfig, new JsonSerializerOptions { WriteIndented = true }));
622Assert.True(File.Exists((string)args[2]), "Custom runtime config file should exist");
626var customConfigContent = File.ReadAllText((string)args[2]);
654File.Delete(tempDir);
663File.WriteAllText(dashboardExe, "mock exe content");
664File.WriteAllText(dashboardDll, "mock dll content");
680File.WriteAllText(runtimeConfig, JsonSerializer.Serialize(originalConfig, new JsonSerializerOptions { WriteIndented = true }));
702Assert.True(File.Exists((string)args[2]), "Custom runtime config file should exist");
723File.Delete(tempDir);
732File.WriteAllText(dashboardExe, "mock exe content");
733File.WriteAllText(dashboardDll, "mock dll content");
749File.WriteAllText(runtimeConfig, JsonSerializer.Serialize(originalConfig, new JsonSerializerOptions { WriteIndented = true }));
771Assert.True(File.Exists((string)args[2]), "Custom runtime config file should exist");
792File.Delete(tempDir);
800File.WriteAllText(dashboardDll, "mock dll content");
816File.WriteAllText(runtimeConfig, JsonSerializer.Serialize(originalConfig, new JsonSerializerOptions { WriteIndented = true }));
838Assert.True(File.Exists((string)args[2]), "Custom runtime config file should exist");
MSBuildTests.cs (58)
31File.WriteAllText(Path.Combine(appHostDirectory, "AppHost.csproj"),
60File.WriteAllText(Path.Combine(appHostDirectory, "AppHost.cs"),
88File.WriteAllText(Path.Combine(appHostDirectory, "AppHost.csproj"),
116File.WriteAllText(Path.Combine(appHostDirectory, "AppHost.cs"),
127var appHostMetadata = await File.ReadAllTextAsync(Path.Combine(metadataDirectory, "_AppHost.ProjectMetadata.g.cs"));
128var appMetadata = await File.ReadAllTextAsync(Path.Combine(metadataDirectory, "App.ProjectMetadata.g.cs"));
155File.WriteAllText(Path.Combine(basePath, "Directory.Build.props"),
167File.WriteAllText(Path.Combine(basePath, "Directory.Build.targets"),
185File.WriteAllText(Path.Combine(libraryDirectory, $"{name}.csproj"),
197File.WriteAllText(Path.Combine(libraryDirectory, "Class1.cs"),
212File.WriteAllText(Path.Combine(appDirectory, $"{name}.csproj"),
223File.WriteAllText(Path.Combine(appDirectory, "Program.cs"),
329File.WriteAllText(projectPath, """
368var resolvedPaths = await File.ReadAllLinesAsync(Path.Combine(appHostDirectory, "obj", "resolved-aspire-paths.txt"));
392var resolvedPaths = await File.ReadAllLinesAsync(Path.Combine(appHostDirectory, "obj", "resolved-aspire-paths.txt"));
416var resolvedPaths = await File.ReadAllLinesAsync(Path.Combine(appHostDirectory, "obj", "resolved-aspire-paths.txt"));
462var resolvedPaths = await File.ReadAllLinesAsync(Path.Combine(appHostDirectory, "obj", "resolved-aspire-paths.txt"));
487var resolvedPaths = await File.ReadAllLinesAsync(Path.Combine(appHostDirectory, "obj", "resolved-aspire-paths.txt"));
611var resolvedPaths = await File.ReadAllLinesAsync(Path.Combine(appHostDirectory, "obj", "resolved-aspire-paths.txt"));
665var resolvedPaths = await File.ReadAllLinesAsync(Path.Combine(appHostDirectory, "obj", "resolved-aspire-paths.txt"));
690File.WriteAllText(Path.Combine(nativeCliDirectory.FullName, ".aspire-install.json"), """{"source":"dotnet-tool"}""");
701var resolvedPaths = await File.ReadAllLinesAsync(Path.Combine(appHostDirectory, "obj", "resolved-aspire-paths.txt"));
730var resolvedPaths = await File.ReadAllLinesAsync(Path.Combine(appHostDirectory, "obj", "resolved-aspire-paths.txt"));
786File.Copy(Path.Combine(Environment.SystemDirectory, "where.exe"), dnxPath);
790File.WriteAllText(dnxPath, "#!/bin/sh\nexit 42\n");
791File.SetUnixFileMode(dnxPath, UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute);
841File.WriteAllText(Path.Combine(appHostDirectory, "AppHost.fsproj"),
862var property = await File.ReadAllTextAsync(Path.Combine(appHostDirectory, "obj", "aspire-use-cli-bundle.txt"));
887var appMetadata = await File.ReadAllTextAsync(metadataPath);
902File.WriteAllText(Path.Combine(appHostDirectory, "AppHost.csproj"),
940File.WriteAllText(Path.Combine(appHostDirectory, "AppHost.cs"),
957File.WriteAllText(Path.Combine(basePath, "Directory.Build.props"),
967File.WriteAllText(Path.Combine(basePath, "Directory.Build.targets"),
1002File.WriteAllText(Path.Combine(dcpDir, OperatingSystem.IsWindows() ? "dcp.exe" : "dcp"), "");
1004File.WriteAllText(managedPath, "");
1012File.WriteAllText(cliPath, "");
1041File.WriteAllText(cliPath, contents.ReplaceLineEndings(OperatingSystem.IsWindows() ? "\r\n" : "\n"));
1044File.SetUnixFileMode(cliPath, UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute);
1067File.WriteAllText(cliPath, contents.ReplaceLineEndings(OperatingSystem.IsWindows() ? "\r\n" : "\n"));
1070File.SetUnixFileMode(cliPath, UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute);
1093File.WriteAllText(cliPath, contents.ReplaceLineEndings(OperatingSystem.IsWindows() ? "\r\n" : "\n"));
1096File.SetUnixFileMode(cliPath, UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute);
1133return executableNames.Any(executableName => File.Exists(Path.Combine(directory.Trim().Trim('"'), executableName)));
1151File.WriteAllText(Path.Combine(appHostDirectory, "AppHost.csproj"),
1180File.WriteAllText(Path.Combine(appHostDirectory, "AppHost.cs"),
1210File.WriteAllText(Path.Combine(appHostDirectory, "AppHost.csproj"),
1239File.WriteAllText(Path.Combine(appHostDirectory, "AppHost.cs"),
1263File.WriteAllText(Path.Combine(projectDirectory, "MyHostingExtension.csproj"),
1280File.WriteAllText(Path.Combine(projectDirectory, "Extensions.cs"),
1312File.WriteAllText(Path.Combine(projectDirectory, "MyHostingExtension.csproj"),
1329File.WriteAllText(Path.Combine(projectDirectory, "Extensions.cs"),
1445File.WriteAllText(nuGetConfigPath,
1487File.WriteAllText(Path.Combine(projectDirectory, "MyHostingExtension.csproj"),
1510File.WriteAllText(Path.Combine(projectDirectory, "Extensions.cs"),
1537File.WriteAllText(Path.Combine(basePath, "Directory.Build.props"),
1549File.WriteAllText(Path.Combine(basePath, "Directory.Build.targets"),
1577File.WriteAllText(Path.Combine(appHostDirectory, "AppHost.csproj"),
1605File.WriteAllText(Path.Combine(appHostDirectory, "AppHost.cs"),
PathLookupHelperTests.cs (15)
18File.WriteAllText(executablePath, string.Empty);
53File.WriteAllText(nonExecutablePath, string.Empty);
54File.SetUnixFileMode(nonExecutablePath, UnixFileMode.UserRead | UnixFileMode.UserWrite);
57File.WriteAllText(executablePath, string.Empty);
58File.SetUnixFileMode(executablePath, UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute);
76File.WriteAllText(Path.Combine(binPath, "mycommand"), string.Empty);
96File.WriteAllText(Path.Combine(binPath, "mycommand.exe"), string.Empty);
218File.WriteAllText(nonExecutablePath, string.Empty);
219File.SetUnixFileMode(nonExecutablePath, UnixFileMode.UserRead | UnixFileMode.UserWrite);
222File.WriteAllText(executablePath, string.Empty);
223File.SetUnixFileMode(executablePath, UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute);
227if (!File.Exists(path))
238return (File.GetUnixFileMode(path) & ExecuteBits) != 0;
513File.SetUnixFileMode(path, File.GetUnixFileMode(path) | UnixFileMode.UserExecute);
WithTerminalTests.cs (69)
329File.Exists(host.Layout.MetadataPath),
334File.WriteAllText(host.Layout.ProducerUdsPath, string.Empty);
335File.WriteAllText(host.Layout.ConsumerUdsPath, string.Empty);
336File.WriteAllText(host.Layout.ControlUdsPath, string.Empty);
343Assert.False(File.Exists(path), $"Expected '{path}' to be deleted after ApplicationStopped.");
379Assert.True(File.Exists(host.Layout.MetadataPath));
381using var doc = JsonDocument.Parse(await File.ReadAllTextAsync(host.Layout.MetadataPath));
405Assert.False(File.Exists(TerminalHostPaths.GetMetadataTemporaryPath(host.Layout.MetadataPath)));
410var mode = File.GetUnixFileMode(host.Layout.MetadataPath);
449File.WriteAllText(orphanProducerPath, string.Empty);
450File.WriteAllText(orphanConsumerPath, string.Empty);
451File.WriteAllText(orphanControlPath, string.Empty);
465Assert.False(File.Exists(orphanMetadataPath), "Dead-owner sidecar should be swept on startup.");
466Assert.False(File.Exists(orphanProducerPath), "Dead-owner producer socket should be swept on startup.");
467Assert.False(File.Exists(orphanConsumerPath), "Dead-owner consumer socket should be swept on startup.");
468Assert.False(File.Exists(orphanControlPath), "Dead-owner control socket should be swept on startup.");
503File.WriteAllText(liveProducerPath, string.Empty);
517Assert.True(File.Exists(liveMetadataPath), "Live-owner sidecar must be preserved by the sweep.");
518Assert.True(File.Exists(liveProducerPath), "Live-owner socket must be preserved by the sweep.");
552File.WriteAllText(producerPath, string.Empty);
558Assert.False(File.Exists(metadataPath));
559Assert.False(File.Exists(producerPath));
587File.WriteAllText(producerPath, string.Empty);
588File.WriteAllText(sentinelPath, string.Empty);
589File.SetLastWriteTimeUtc(
597Assert.True(File.Exists(metadataPath));
598Assert.True(File.Exists(producerPath));
599Assert.True(File.Exists(sentinelPath), "Metadata content must never be used as a file search pattern.");
617File.WriteAllText(metadataPath, """{"schemaVersion":""");
618File.WriteAllText(producerPath, string.Empty);
624Assert.True(File.Exists(metadataPath));
625Assert.True(File.Exists(producerPath));
643File.WriteAllText(metadataPath, """{"schemaVersion":""");
644File.WriteAllText(producerPath, string.Empty);
645File.SetLastWriteTimeUtc(
651Assert.True(File.Exists(metadataPath));
652Assert.True(File.Exists(producerPath));
661File.WriteAllText(metadataPath, """{"schemaVersion":""");
662File.SetLastWriteTimeUtc(
668Assert.False(File.Exists(metadataPath));
681File.WriteAllText(expiredPath, string.Empty);
682File.WriteAllText(recentPath, string.Empty);
683File.SetLastWriteTimeUtc(
691Assert.False(File.Exists(expiredPath));
692Assert.True(File.Exists(recentPath));
717File.WriteAllText(producerPath, string.Empty);
723Assert.True(File.Exists(metadataPath));
724Assert.True(File.Exists(producerPath));
747File.WriteAllText(producerPath, string.Empty);
748File.SetLastWriteTimeUtc(
756Assert.True(File.Exists(metadataPath));
757Assert.True(File.Exists(producerPath));
783File.WriteAllText(producerPath, string.Empty);
787Assert.True(File.Exists(metadataPath));
788Assert.True(File.Exists(producerPath));
809File.WriteAllText(producerPath, string.Empty);
813Assert.True(File.Exists(metadataPath));
814Assert.True(File.Exists(producerPath));
836File.WriteAllText(producerPath, string.Empty);
840Assert.True(File.Exists(metadataPath));
841Assert.True(File.Exists(producerPath));
867File.WriteAllText(producerPath, string.Empty);
871Assert.False(File.Exists(metadataPath));
872Assert.False(File.Exists(producerPath));
885File.WriteAllText(metadataPath, "{}");
891Assert.True(File.Exists(metadataPath));
896File.Delete(metadataPath);
991File.WriteAllText(metadataPath, JsonSerializer.Serialize(metadata));
1027File.Delete(path);
Aspire.Hosting.TestUtilities (5)
Aspire.Hosting.Yarp (1)
Aspire.Hosting.Yarp.Tests (2)
Aspire.Managed.Tests (9)
Aspire.Playground.Tests (6)
Aspire.RuntimeIdentifier.Tool (1)
Aspire.Templates.Tests (40)
NewUpAndBuildStandaloneTemplateTests.cs (5)
59var appContent = await File.ReadAllTextAsync(Path.Combine(webProjectDirectory, "Components", "App.razor"));
63var importsContent = await File.ReadAllTextAsync(Path.Combine(webProjectDirectory, "Components", "_Imports.razor"));
66var errorPageContent = await File.ReadAllTextAsync(Path.Combine(webProjectDirectory, "Components", "Pages", "Error.razor"));
69var navMenuContent = await File.ReadAllTextAsync(Path.Combine(webProjectDirectory, "Components", "Layout", "NavMenu.razor"));
76Assert.True(File.Exists(Path.Combine(webProjectDirectory, "Components", "Layout", "NavMenu.razor.js")));
tests\Shared\TemplatesTesting\AspireProject.cs (9)
65File.WriteAllText(Path.Combine(dir, "Directory.Build.props"), "<Project />");
66File.WriteAllText(Path.Combine(dir, "Directory.Build.targets"), "<Project />");
73File.Copy(srcNuGetConfigPath, targetNuGetConfigPath);
107File.WriteAllText(Path.Combine(rootDir, "Directory.Build.props"), "<Project />");
108File.WriteAllText(Path.Combine(rootDir, "Directory.Build.targets"), "<Project />");
133var csprojContent = File.ReadAllText(csprojPath);
153File.Copy(Path.Combine(BuildEnvironment.TestAssetsPath, "EndPointWriterHook_cs"), Path.Combine(project.AppHostProjectDirectory, "EndPointWriterHook.cs"));
155string programCs = File.ReadAllText(programCsPath);
158File.WriteAllText(programCsPath, programCs);
Aspire.TerminalHost (10)
Aspire.TerminalHost.Tests (13)
Aspire.TestTools (10)
Aspire.TestUtilities (3)
AzureSearch.ApiService (1)
blazor-devserver (1)
CatalogService (1)
cdac-build-tool (3)
CodeStyleConfigFileGenerator (2)
ConfigurationSchemaGenerator (1)
ConfigurationSchemaGenerator.Tests (3)
crossgen2 (5)
Crossgen2Tasks (13)
csc (6)
CSharpSyntaxGenerator (3)
datacollector (2)
datacollector.arm64 (2)
dotnet (179)
Commands\Workload\Install\FileBasedInstaller.cs (18)
181if (!File.Exists(packagePath))
204File.Copy(packagePath, packInfo.Path, overwrite: overwriteExistingPacks);
252if (File.Exists(file))
254File.Delete(file);
323if (!File.Exists(packagePath))
363if (!string.IsNullOrEmpty(packagePath) && File.Exists(packagePath) && (offlineCache == null || !offlineCache.HasValue))
365File.Delete(packagePath);
536var jsonPackInfo = File.ReadAllText(GetPackInstallRecordPath(packId, packVersion, featureBandsToRemove.First()));
540File.Delete(GetPackInstallRecordPath(packId, packVersion, featureBand));
598File.WriteAllText(path, installStateContents.ToString());
639File.WriteAllText(logFile, JsonSerializer.Serialize(workloadHistoryRecord, WorkloadHistoryJsonSerializerContext.Default.WorkloadHistoryRecord));
664return File.Exists(packInfo.Path);
679File.Delete(packInfo.Path);
704using var _ = File.Create(path);
755using var _ = File.Create(path);
848File.WriteAllText(path, JsonSerializer.Serialize(packInfo, PackInfoJsonSerializerContext.Default.PackInfo));
854if (File.Exists(packInstallRecord))
856File.Delete(packInstallRecord);
dotnet-aot (72)
dotnet-dev-certs (29)
dotnet-format (7)
dotnet-getdocument (9)
dotnet-Microsoft.XmlSerializer.Generator (9)
dotnet-openapi (9)
dotnet-razorpagegenerator (3)
dotnet-sourcelink (3)
dotnet-sql-cache (1)
dotnet-suggest (5)
dotnet-svcutil-lib (48)
Shared\MSBuildProj.cs (10)
147var project = await ParseAsync(File.ReadAllText(filePath), filePath, logger, cancellationToken).ConfigureAwait(false);
154var project = await ParseAsync(File.ReadAllText(filePath), filePath, logger, cancellationToken, tfMoniker).ConfigureAwait(false);
322if (fullPath == null || !File.Exists(fullPath))
396if (File.Exists(fullPath))
412project = await ParseAsync(File.ReadAllText(fullPath), fullPath, logger, cancellationToken).ConfigureAwait(false);
706using (StreamWriter writer = File.CreateText(this.FullPath))
803if (File.Exists(assetsFile) && !(this.TargetFramework.Contains("-") && !this.TargetFramework.ToLower().Contains("windows")))
888if (File.Exists(depsFile))
895using (var stream = File.OpenRead(depsFile))
920if (File.Exists(dependency.FullPath) && !assemblyDependencies.Contains(dependency))
dotnet-svcutil-lib.Tests (52)
GlobalToolTests.cs (4)
113File.Copy(Path.Combine(g_TestCasesDir, "FullFramework", "FullFramework.cs"), Path.Combine(this_TestCaseOutputDir, "FullFramework.cs"), true);
114File.Copy(Path.Combine(g_TestCasesDir, "FullFramework", "FullFramework.csproj"), Path.Combine(this_TestCaseOutputDir, "FullFramework.csproj"), true);
141File.Copy(Path.Combine(g_TestCasesDir, this_TestCaseName, testCaseName, "Program.cs"), Path.Combine(this_TestCaseOutputDir, "Program.cs"), true);
142File.Copy(Path.Combine(g_TestCasesDir, this_TestCaseName, testCaseName, $"{testCaseName}.csproj"), Path.Combine(this_TestCaseOutputDir, $"{testCaseName}.csproj"), true);
TestInit.cs (20)
60File.WriteAllText(Path.Combine(g_TestOutputDir, "Directory.Build.props"), "<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\" />");
61File.WriteAllText(Path.Combine(g_TestOutputDir, "Directory.Build.targets"), "<Project></Project>");
95if (!File.Exists(filePath))
115File.Copy(project.FullPath, projectPath);
116File.Copy(srcProgramPath, programPath);
118File.WriteAllText(programPath, File.ReadAllText(programPath)
167Assert.True(File.Exists(g_StarterProject.FullPath), $"{nameof(g_StarterProject)} is not initialized!");
173File.WriteAllText(Path.Combine(g_TestOutputDir, "Directory.Build.props"), "<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\" />");
174File.WriteAllText(Path.Combine(g_TestOutputDir, "Directory.Build.targets"), "<Project></Project>");
268if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) && File.Exists(Path.Combine(linuxBaselinePath, Path.GetFileName(this_TestCaseLogFile))))
335File.WriteAllText(this.this_TestCaseLogFile, logText);
354if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) && File.Exists(Path.Combine(linuxBaselinePath, Path.GetFileName(this_TestCaseLogFile))))
430File.Copy(generated, expected);
458File.WriteAllText(scriptPath, cmdStr.ToString());
472fileLines1.AddRange(File.ReadAllLines(baselineFile));
473fileLines2.AddRange(File.ReadAllLines(generatedFile));
590Assert.True(rootSolutionFolder != null && File.Exists(rootSolutionFolder), $"Unable to find dotnet-svcutil.sln file, current dir: {parentDir}");
606File.WriteAllText(Path.Combine(directory, "global.json"), globalConfig);
624File.WriteAllText(Path.Combine(g_TestOutputDir, "nuget.config"), nugetConfigText.Replace("$svcutilTestFeed$", g_SvcutilNugetFeed));
UnitTest.cs (8)
225File.Copy(Path.Combine(g_TestCasesDir, "wsdl", "Simple.wsdl"), Path.Combine(this_TestGroupOutputDir, "wsdl", "Simple.wsdl"));
271File.WriteAllText(this_TestCaseLogFile, this_FixupUtil.ReplaceText(log));
309File.WriteAllText(this_TestCaseLogFile, this_FixupUtil.ReplaceText(log));
331File.Copy(jsonFileSrcPath, jsonFileDstPath);
332File.WriteAllText(jsonFileDstPath, File.ReadAllText(jsonFileDstPath).Replace("$testCaseProject$", this_TestCaseProject.FullPath.Replace("\\", "/")));
348var jsonText = File.ReadAllText(jsonFileSrcPath);
354File.WriteAllText(outJsonFile, options.Json);
dotnet-svcutil.xmlserializer (9)
dotnet-svcutil.xmlserializer.IntegrationTests (4)
dotnet-user-jwts (17)
dotnet-user-secrets (11)
dotnet-watch (6)
DotNetWatchTasks (1)
GenerateAnalyzerNuspec (6)
GenerateDocumentationAndConfigFiles (21)
GetDocument.Insider (5)
HelixTestTasks (1)
ilasm (13)
ILAssembler (1)
ilc (8)
ILCompiler.Build.Tasks (3)
ILCompiler.Compiler (8)
ILCompiler.Diagnostics (4)
ILCompiler.ReadyToRun (4)
illink (23)
Linker.Steps\OutputStep.cs (16)
68using (var w = File.CreateText(Context.AssemblyListFile))
158using (var fs = File.Open(Path.Combine(Context.OutputDirectory, Context.PInvokesListFile), FileMode.Create))
172if (File.Exists(target))
174File.Delete(target);
175File.Delete(target + ".mdb");
176File.Delete(Path.ChangeExtension(target, "pdb"));
177File.Delete(GetConfigFile(target));
220if (!File.Exists(satelliteAssembly))
227File.Copy(satelliteAssembly, Path.Combine(culturePath, resourceFile), true);
234if (!File.Exists(config))
242File.Copy(config, GetConfigFile(GetAssemblyFileName(assembly, directory)), true);
269File.Copy(source, target, true);
274if (File.Exists(mdb))
275File.Copy(mdb, target + ".mdb", true);
278if (File.Exists(pdb))
279File.Copy(pdb, Path.ChangeExtension(target, "pdb"), true);
ILLink.Tasks (9)
Infrastructure.Common (1)
Infrastructure.Tests (287)
CreateFailingTestIssue\CreateFailingTestIssueToolTests.cs (23)
72var diagnosticsLog = File.ReadAllText(Path.Combine(fixtureDirectory, "diagnostics.log"));
83File.WriteAllText(
88File.WriteAllText(
122File.WriteAllText(
133File.WriteAllText(Path.Combine(fixtureDirectory, "add-issue-comment.json"), "{}");
153var diagnosticsLog = File.ReadAllText(Path.Combine(fixtureDirectory, "diagnostics.log"));
163File.WriteAllText(
174File.WriteAllText(Path.Combine(fixtureDirectory, "reopen-issue.json"), "{}");
175File.WriteAllText(Path.Combine(fixtureDirectory, "add-issue-comment.json"), "{}");
195var diagnosticsLog = File.ReadAllText(Path.Combine(fixtureDirectory, "diagnostics.log"));
205File.WriteAllText(
210File.WriteAllText(
237var diagnosticsLog = File.ReadAllText(Path.Combine(fixtureDirectory, "diagnostics.log"));
247File.WriteAllText(
257File.WriteAllText(
285var diagnosticsLog = File.ReadAllText(Path.Combine(fixtureDirectory, "diagnostics.log"));
431var diagnosticsLog = File.ReadAllText(Path.Combine(fixtureDirectory, "diagnostics.log"));
530var diagnosticsLog = File.ReadAllText(Path.Combine(fixtureDirectory, "diagnostics.log"));
560var queuedDiagnosticsLog = File.ReadAllText(Path.Combine(fixtureDirectory, "diagnostics.log"));
586var failedDiagnosticsLog = File.ReadAllText(Path.Combine(fixtureDirectory, "diagnostics.log"));
977=> File.WriteAllText(GetFixturePath(fixtureDirectory, endpoint, ".json"), json);
980=> File.WriteAllText(GetFixturePath(fixtureDirectory, endpoint, ".txt"), text);
983=> File.WriteAllText(GetFixturePath(fixtureDirectory, endpoint, ".err"), text);
GenerateTestSummary\GenerateTestSummaryToolTests.cs (10)
65await File.ReadAllTextAsync(jsonPath),
92await File.ReadAllTextAsync(jsonPath),
115await File.ReadAllTextAsync(jsonPath),
135await File.WriteAllTextAsync(Path.Combine(trxDir, "broken.trx"), "this is not valid trx xml <<<");
142await File.ReadAllTextAsync(jsonPath),
165await File.WriteAllTextAsync(Path.Combine(trxDir, "broken.trx"), "this is not valid trx xml <<<");
172await File.ReadAllTextAsync(jsonPath),
192await File.WriteAllTextAsync(Path.Combine(trxDir, "broken.trx"), "this is not valid trx xml <<<");
199await File.ReadAllTextAsync(jsonPath),
230await File.ReadAllTextAsync(jsonPath),
Pipelines\NpmCliPackageTests.cs (14)
181await File.WriteAllTextAsync(
221await File.WriteAllTextAsync(
270var readme = await File.ReadAllTextAsync(Path.Combine(package.PointerPackageRoot, "README.md"));
353Assert.True(File.Exists(Path.Combine(package.RidPackageRoot, "bin", expectation.BinaryName)));
355var readme = await File.ReadAllTextAsync(Path.Combine(package.RidPackageRoot, "README.md"));
502=> File.ReadAllTextAsync(Path.Combine(_repoRoot, relativePath.Replace('/', Path.DirectorySeparatorChar)));
512File.Copy(
516await File.WriteAllTextAsync(
531await File.WriteAllTextAsync(Path.Combine(pointerBinRoot, "aspire-package-map.json"), packageMap.ToJsonString());
541await File.WriteAllTextAsync(
550await File.WriteAllTextAsync(Path.Combine(ridBinRoot, "aspire"), "native binary stub");
551await File.WriteAllTextAsync(Path.Combine(ridBinRoot, "aspire.exe"), "native binary stub");
577await File.WriteAllTextAsync(nativeBinaryPath, "native binary stub");
696var json = File.ReadAllText(path);
PowerShellScripts\TrustedExtensionReleasePrTests.cs (16)
42File.WriteAllText(PackageJsonPath, BasePackageJson);
43File.WriteAllText(ChangelogPath, BaseChangelog);
84File.WriteAllText(Path.Combine(_workspace.Path, "base-only.txt"), "unrelated base change");
115File.WriteAllText(Path.Combine(_workspace.Path, "unexpected.txt"), "unexpected");
126File.WriteAllText(
129File.WriteAllText(ChangelogPath, TrustedChangelog);
140File.WriteAllText(
151File.WriteAllText(
168File.WriteAllText(PackageJsonPath, TrustedPackageJson);
169File.WriteAllText(ChangelogPath, headChangelog);
180File.WriteAllText(PackageJsonPath, TrustedPackageJson);
181File.WriteAllText(
217File.WriteAllText(PackageJsonPath, TrustedPackageJson);
218File.WriteAllText(ChangelogPath, TrustedChangelog);
238File.WriteAllText(_githubOutputPath, string.Empty);
262private string ReadGitHubOutput() => File.ReadAllText(_githubOutputPath).Trim();
PowerShellScripts\ValidateNpmPackageSignaturesTests.cs (14)
55File.WriteAllText(filePath, "hi");
71File.WriteAllText(Path.Combine(shipping, "Aspire.Hosting.13.4.0.nupkg"), "decoy");
85File.WriteAllBytes(tgz, [0x1f, 0x8b]); // anything; content not inspected
101File.WriteAllBytes(tgz, [0x1f, 0x8b]);
104File.WriteAllBytes($"{tgz}.sig", Enumerable.Repeat((byte)0xC2, 32).ToArray());
119File.WriteAllBytes(tgz, [0x1f, 0x8b]);
123File.WriteAllBytes($"{tgz}.sig", new byte[128]);
138File.WriteAllBytes(tgz, [0x1f, 0x8b]);
144File.WriteAllBytes($"{tgz}.sig", armored);
164File.WriteAllBytes(tgz, [0x1f, 0x8b]);
170File.WriteAllBytes($"{tgz}.sig", sig);
189File.WriteAllBytes(tgzMissing, [0x1f, 0x8b]);
190File.WriteAllBytes(tgzBadPrefix, [0x1f, 0x8b]);
191File.WriteAllBytes($"{tgzBadPrefix}.sig", new byte[128]); // bad prefix
TestTriggerMap\SelectTestsCliTests.cs (38)
74Assert.False(File.Exists(propsPath));
93File.WriteAllText(slnxPath, Slnx);
94File.WriteAllText(Path.Combine(dir.FullName, "map.yml"), Map);
106Assert.Contains("Aspire.Hosting.Tests", File.ReadAllText(propsPath));
132var props = File.ReadAllText(propsPath);
156var comment = File.ReadAllText(commentPath);
208var comment = File.ReadAllText(commentPath);
264var comment = File.ReadAllText(commentPath);
305var comment = File.ReadAllText(commentPath);
336var comment = File.ReadAllText(commentPath);
367using var doc = JsonDocument.Parse(File.ReadAllText(jsonPath));
454Assert.False(File.Exists(propsPath));
561Assert.False(File.Exists(propsPath));
602var summary = File.ReadAllText(Path.Combine(repoRoot, "summary"));
643var props = File.ReadAllText(propsPath);
683Assert.False(File.Exists(propsPath));
687var summary = File.ReadAllText(Path.Combine(repoRoot, "summary"));
724var summary = File.ReadAllText(Path.Combine(repoRoot, "summary"));
730var comment = File.ReadAllText(commentPath);
735using var doc = JsonDocument.Parse(File.ReadAllText(jsonPath));
768var props = File.ReadAllText(propsPath);
809Assert.Contains("Aspire.Cli.Tests", File.ReadAllText(propsPath));
847Assert.Contains("Aspire.Hosting.Tests", File.ReadAllText(propsPath));
861File.WriteAllText(changed, "\n trigger.txt \n\n\t\n");
865Assert.Contains("Aspire.Hosting.Tests", File.ReadAllText(propsPath));
888Assert.False(File.Exists(propsPath));
906var props = File.ReadAllText(propsPath);
938Assert.False(File.Exists(propsPath));
965File.WriteAllText(Path.Combine(repoRoot, "skip-patterns.txt"), "# docs\n**.md\n");
971var summary = File.ReadAllText(Path.Combine(repoRoot, "summary"));
979File.WriteAllText(Path.Combine(repoRoot, "skip-patterns.txt"), ".github/workflows/**\n");
984Assert.Contains("Aspire.Hosting.Tests", File.ReadAllText(propsPath));
1015File.WriteAllLines(changed, paths);
1030File.WriteAllText(Path.Combine(dir.FullName, "Aspire.slnx"), slnx);
1031File.WriteAllText(Path.Combine(dir.FullName, "map.yml"), map);
1075if (File.Exists(outputPath))
1077foreach (var line in File.ReadAllLines(outputPath))
1115File.WriteAllText(fullPath, contents);
TestTriggerMap\TestTriggerMapTests.cs (9)
142var slnx = File.ReadAllText(Path.Combine(RepoRoot.Path, "Aspire.slnx"));
170.Where(rel => File.Exists(Path.Combine(RepoRoot.Path, rel)))
270var testsYml = File.ReadAllText(Path.Combine(workflowsDir, "tests.yml"));
272bool WorkflowExists(string file) => File.Exists(Path.Combine(workflowsDir, file));
314var testsYml = File.ReadAllText(Path.Combine(RepoRoot.Path, ".github", "workflows", "tests.yml"));
373var testsYml = File.ReadAllText(Path.Combine(RepoRoot.Path, ".github", "workflows", "tests.yml"));
413.Where(name => !File.Exists(Path.Combine(RepoRoot.Path, "tests", name, $"{name}.csproj")))
427Assert.True(File.Exists(Path.Combine(RepoRoot.Path, s_map.Prefilter.PatternsFile!)),
505.SelectMany(f => usesLocalAction.Matches(File.ReadAllText(f)).Select(m => m.Groups["name"].Value))
WorkflowScripts\ExtensionReleaseFastPathWorkflowTests.cs (5)
191Assert.False(File.Exists(RepoPath(".github", "workflows", "copilot-review-dispatch.yml")));
193var skill = File.ReadAllText(RepoPath(".agents", "skills", "code-review", "SKILL.md"));
211var action = File.ReadAllText(
220var skill = File.ReadAllText(RepoPath(".agents", "skills", "code-review", "SKILL.md"));
398using var reader = new StringReader(File.ReadAllText(RepoPath(".github", "workflows", workflowName)));
WorkflowScripts\SelectTestsCommentScriptTests.cs (4)
181File.WriteAllText(path, content);
232await File.WriteAllTextAsync(requestPath, JsonSerializer.Serialize(new { script, commentFile, context, liveHeadSha, existingComments }, s_jsonOptions));
242var response = JsonSerializer.Deserialize<HarnessResponse<CommentScriptResult>>(await File.ReadAllTextAsync(outputPath), s_jsonOptions);
252var lines = File.ReadAllText(Path.Combine(_repoRoot, ".github", "workflows", "tests.yml"))
installer.tasks (7)
Microsoft.Agents.AI.ProjectTemplates.Tests (2)
Microsoft.Analyzers.Extra.Tests (1)
Microsoft.Analyzers.Local.Tests (1)
Microsoft.Arcade.Common (10)
Microsoft.AspNetCore.Components.Testing (6)
Microsoft.AspNetCore.Components.Testing.Tasks (3)
Microsoft.AspNetCore.Components.WebAssembly (2)
Microsoft.AspNetCore.Components.WebAssembly.Server (2)
Microsoft.AspNetCore.Components.WebView (2)
Microsoft.AspNetCore.DataProtection (10)
Microsoft.AspNetCore.DeveloperCertificates.XPlat (28)
Microsoft.AspNetCore.Diagnostics (3)
Microsoft.AspNetCore.Hosting (5)
Microsoft.AspNetCore.HttpLogging (1)
Microsoft.AspNetCore.InternalTesting (10)
Microsoft.AspNetCore.Mvc.Core (1)
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation (1)
Microsoft.AspNetCore.Mvc.Testing (3)
Microsoft.AspNetCore.Mvc.Testing.Tasks (1)
Microsoft.AspNetCore.Razor.Utilities.Shared (1)
Microsoft.AspNetCore.Server.IIS (3)
Microsoft.AspNetCore.Server.IntegrationTesting (10)
Microsoft.AspNetCore.Server.Kestrel.Core (30)
Microsoft.AspNetCore.SpaProxy (2)
Microsoft.AspNetCore.StaticAssets (2)
Microsoft.AspNetCore.WebUtilities (2)
Microsoft.Build (30)
Microsoft.Build.Framework (15)
Microsoft.Build.NuGetSdkResolver (1)
Microsoft.Build.Tasks.CodeAnalysis (19)
Microsoft.Build.Tasks.Core (72)
ManifestUtil\TrustInfo.cs (6)
435using (Stream s = File.Open(path, FileMode.Open, FileAccess.Read, FileShare.Read))
474using (Stream s = File.Open(path, FileMode.Open, FileAccess.Read, FileShare.Read))
552using (Stream s = File.Open(path, FileMode.Create, FileAccess.Write, FileShare.None))
643File.Delete(tempPrivilegeDocument);
661s = File.Open(path, FileMode.Open, FileAccess.ReadWrite, FileShare.None);
665s = File.Open(path, FileMode.Create, FileAccess.Write, FileShare.None);
Microsoft.Build.Tasks.Git (23)
Microsoft.Build.Utilities.Core (12)
Microsoft.CodeAnalysis (32)
Microsoft.CodeAnalysis.Analyzers (5)
Microsoft.CodeAnalysis.AnalyzerUtilities (4)
Microsoft.CodeAnalysis.CodeStyle (2)
Microsoft.CodeAnalysis.CodeStyle.Fixes (1)
Microsoft.CodeAnalysis.CSharp.Workspaces (7)
Microsoft.CodeAnalysis.ExternalAccess.HotReload (2)
Microsoft.CodeAnalysis.Features (19)
Microsoft.CodeAnalysis.NetAnalyzers (2)
Microsoft.CodeAnalysis.Razor.Compiler (1)
Microsoft.CodeAnalysis.ResxSourceGenerator (4)
Microsoft.CodeAnalysis.Scripting (15)
Microsoft.CodeAnalysis.VisualBasic (1)
Microsoft.CodeAnalysis.Workspaces (16)
Microsoft.CodeAnalysis.Workspaces.MSBuild (15)
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (1)
Microsoft.CodeAnalysis.Workspaces.MSBuild.Contracts (1)
Microsoft.Data.Analysis (1)
Microsoft.Data.Analysis.Tests (3)
Microsoft.Deployment.DotNet.Releases (10)
Microsoft.Diagnostics.NETCore.Client (4)
Microsoft.DotNet.ApiCompat.Task (4)
Microsoft.DotNet.ApiSymbolExtensions (9)
Microsoft.DotNet.Arcade.Sdk (23)
Microsoft.DotNet.Build.Tasks.Feed (3)
Microsoft.DotNet.Build.Tasks.FileCatalog (5)
Microsoft.DotNet.Build.Tasks.Installers (39)
src\CreateWixBuildWixpack.cs (18)
115File.Copy(projectPath, destPath, overwrite: true);
148if (File.Exists(OutputFile))
150File.Delete(OutputFile);
202File.Copy(includeFile, tempFilePath, overwrite: true);
212File.Delete(tempFilePath);
432File.WriteAllText(Path.Combine(WixpackWorkingDir, "create.rsp"), string.Join(System.Environment.NewLine, commandLineArgs));
446File.WriteAllText(Path.Combine(WixpackWorkingDir, "create.cmd"), createCmdFileContents.ToString());
511if (!File.Exists(xmlPath))
519File.Copy(xmlPath, copiedXmlPath, overwrite: true);
639string content = File.ReadAllText(file);
649if (File.Exists(includeFilePath))
667if (File.Exists(potentialPath))
683File.WriteAllText(file, content);
749string input = File.ReadAllText(sourceFile);
933File.WriteAllText(sourceFile, output.ToString());
1021if (File.Exists(source))
1024File.Copy(source, destPath, overwrite: true);
1108File.Copy(file, Path.Combine(destDir, Path.GetFileName(file)), overwrite: true);
Microsoft.DotNet.Build.Tasks.Packaging (23)
Microsoft.DotNet.Build.Tasks.Templating (3)
Microsoft.DotNet.Build.Tasks.VisualStudio (8)
Microsoft.DotNet.Build.Tasks.Workloads (13)
Microsoft.DotNet.Cli.CoreUtils (2)
Microsoft.DotNet.Cli.Definitions (5)
Microsoft.DotNet.Cli.Telemetry (1)
Microsoft.DotNet.Cli.Utils (13)
Microsoft.DotNet.CMake.Sdk (6)
Microsoft.DotNet.GenFacades (9)
Microsoft.DotNet.HotReload.Utils.Generator (7)
Microsoft.DotNet.HotReload.Utils.Generator.Tasks (2)
Microsoft.DotNet.HotReload.Watch (7)
Microsoft.DotNet.InternalAbstractions (8)
Microsoft.DotNet.MacOsPkg.Core (9)
Microsoft.DotNet.NativeWrapper (2)
Microsoft.DotNet.NuGetRepack.Tasks (9)
Microsoft.DotNet.PackageTesting (1)
Microsoft.DotNet.PackageValidation (1)
Microsoft.DotNet.ProjectTools (11)
Microsoft.DotNet.SdkResolver (2)
Microsoft.DotNet.SharedFramework.Sdk (7)
Microsoft.DotNet.SourceBuild.Tasks (13)
Microsoft.DotNet.StrongName (1)
Microsoft.DotNet.TemplateLocator (22)
Microsoft.DotNet.VersionTools.Cli (1)
Microsoft.DotNet.XliffTasks (10)
Tasks\TransformTemplates.cs (4)
80File.Copy(templatePath, cultureSpecificTemplateFile, overwrite: true);
86File.Copy(projectFileFullPath, Path.Combine(localizedTemplateDirectory, Path.GetFileName(projectNode.Attribute("File").Value)), overwrite: true);
114File.Copy(Path.Combine(TranslatedOutputDirectory, localizedFileName), templateItemDestinationPath, overwrite: true);
119File.Copy(templateItemFullPath, templateItemDestinationPath, overwrite: true);
Microsoft.Extensions.AI.Abstractions (2)
Microsoft.Extensions.AI.Abstractions.Tests (72)
Contents\DataContentTests.cs (60)
320await File.WriteAllBytesAsync(tempPath, testData);
332if (File.Exists(tempPath))
334File.Delete(tempPath);
347await File.WriteAllBytesAsync(tempPath, testData);
359if (File.Exists(tempPath))
361File.Delete(tempPath);
374await File.WriteAllBytesAsync(tempPath, testData);
385if (File.Exists(tempPath))
387File.Delete(tempPath);
400await File.WriteAllBytesAsync(tempPath, testData);
413if (File.Exists(tempPath))
415File.Delete(tempPath);
467Assert.True(File.Exists(actualPath));
468Assert.Equal(testData, await File.ReadAllBytesAsync(actualPath));
472if (File.Exists(tempPath))
474File.Delete(tempPath);
494Assert.True(File.Exists(actualPath));
495Assert.Equal(testData, await File.ReadAllBytesAsync(actualPath));
499if (File.Exists(tempPath))
501File.Delete(tempPath);
526Assert.True(File.Exists(actualPath));
527Assert.Equal(testData, await File.ReadAllBytesAsync(actualPath));
555Assert.True(File.Exists(actualPath));
556Assert.Equal(testData, await File.ReadAllBytesAsync(actualPath));
582Assert.True(File.Exists(actualPath));
586if (File.Exists(tempPath))
588File.Delete(tempPath);
611Assert.True(File.Exists(expectedAbsolute));
612Assert.Equal(testData, await File.ReadAllBytesAsync(expectedAbsolute));
616if (File.Exists(expectedAbsolute))
618File.Delete(expectedAbsolute);
640Assert.True(File.Exists(savedPath));
641Assert.Equal(testData, await File.ReadAllBytesAsync(savedPath));
669Assert.True(File.Exists(expectedAbsolute));
670Assert.Equal(testData, await File.ReadAllBytesAsync(expectedAbsolute));
674if (File.Exists(expectedAbsolute))
676File.Delete(expectedAbsolute);
718await File.WriteAllBytesAsync(filePath, testData);
753Assert.True(File.Exists(savedPath));
754Assert.Equal(testData, await File.ReadAllBytesAsync(savedPath));
774await File.WriteAllBytesAsync(tempPath, new byte[] { 1, 2, 3 });
784if (File.Exists(tempPath))
786File.Delete(tempPath);
810if (File.Exists(tempPath))
812File.Delete(tempPath);
850Assert.True(File.Exists(expectedPath));
851Assert.Equal(testData, await File.ReadAllBytesAsync(expectedPath));
879Assert.True(File.Exists(filePath));
880Assert.Equal(testData, await File.ReadAllBytesAsync(filePath));
902await File.WriteAllBytesAsync(tempPath, testData);
911if (File.Exists(tempPath))
913File.Delete(tempPath);
934Assert.Equal(testData, await File.ReadAllBytesAsync(savedPath));
938if (File.Exists(tempPath))
940File.Delete(tempPath);
954await File.WriteAllBytesAsync(tempPath, originalContent);
964Assert.True(File.Exists(tempPath));
965byte[] actualContent = await File.ReadAllBytesAsync(tempPath);
970if (File.Exists(tempPath))
972File.Delete(tempPath);
parent\parent\parent\eng\MSBuild\parent\parent\src\LegacySupport\FilePolyfills\FilePolyfills.cs (1)
21extension(File)
Microsoft.Extensions.AI.Evaluation.Console (5)
Microsoft.Extensions.AI.Evaluation.Reporting (10)
Microsoft.Extensions.AI.Evaluation.Reporting.Tests (2)
Microsoft.Extensions.AI.OpenAI.Tests (3)
Microsoft.Extensions.AI.Templates.Tests (2)
Microsoft.Extensions.DataIngestion.Markdig (1)
Microsoft.Extensions.DataIngestion.MarkItDown (1)
Microsoft.Extensions.DataIngestion.Tests (5)
Microsoft.Extensions.DependencyModel (4)
Microsoft.Extensions.DotNetDeltaApplier (1)
Microsoft.Extensions.FileProviders.Embedded (2)
Microsoft.Extensions.FileProviders.Physical (1)
Microsoft.Extensions.Hosting.Systemd (1)
Microsoft.Extensions.Http.Diagnostics.PerformanceTests (2)
Microsoft.Extensions.Http.Diagnostics.Tests (1)
Microsoft.Extensions.Http.Resilience.Tests (3)
Microsoft.Extensions.Logging.AzureAppServices (1)
Microsoft.Extensions.ML (1)
Microsoft.Extensions.ML.Tests (3)
Microsoft.Extensions.ServiceDiscovery.Dns (6)
Microsoft.Extensions.ServiceDiscovery.Dns.Tests.Fuzzing (1)
Microsoft.Gen.ComplianceReports (1)
Microsoft.Gen.ComplianceReports.Unit.Tests (9)
Microsoft.Gen.ContextualOptions.Unit.Tests (21)
Microsoft.Gen.Logging.Unit.Tests (1)
Microsoft.Gen.MetadataExtractor (3)
Microsoft.Gen.MetadataExtractor.Unit.Tests (11)
Microsoft.Gen.Metrics.Unit.Tests (3)
Microsoft.Gen.MetricsReports (1)
Microsoft.Gen.MetricsReports.Unit.Tests (11)
Microsoft.Maui (3)
Microsoft.Maui.Controls.Build.Tasks (1)
Microsoft.Maui.Resizetizer (22)
Microsoft.ML.AutoML (2)
Microsoft.ML.AutoML.Samples (3)
Microsoft.ML.AutoML.Tests (6)
Microsoft.ML.CodeGenerator (1)
Microsoft.ML.Core (11)
Microsoft.ML.Core.Tests (39)
UnitTests\TestEntryPoints.cs (26)
242File.WriteAllLines(epListPath, epListContents);
248using (var file = File.OpenWrite(manifestPath))
269File.WriteAllLines(path, epListContents);
275using (var file = File.OpenWrite(jPath))
610File.WriteAllLines(jsonPath, new[] { inputGraph });
738File.WriteAllLines(jsonPath, new[] { inputGraph });
886File.WriteAllLines(jsonPath, new[] { inputGraph });
1047File.WriteAllLines(jsonPath, new[] { inputGraph });
1190File.WriteAllLines(jsonPath, new[] { inputGraph });
1337File.WriteAllLines(jsonPath, new[] { inputGraph });
1434File.WriteAllLines(jsonPath, new[] { inputGraph });
2231using (var file = File.OpenWrite(summaryPath))
2241using (var file = File.OpenWrite(summaryKvpPath))
2324File.WriteAllLines(jsonPath, new[] { inputGraph });
2374File.WriteAllLines(jsonPath, new[] { inputGraph });
2419File.WriteAllLines(jsonPath, new[] { inputGraph });
2465File.WriteAllLines(jsonPath, new[] { inputGraph });
2520File.WriteAllLines(jsonPath, new[] { inputGraph });
2635File.WriteAllLines(jsonPath, new[] { inputGraph });
2860File.WriteAllLines(dataFile, new[] {
3255File.WriteAllLines(jsonPath, new[] { inputGraph });
3324File.WriteAllLines(jsonPath, new[] { inputGraph });
4412File.WriteAllLines(jsonPath, new[] { inputGraph });
4517File.WriteAllLines(dataFile, new[] {
6587using (var stream = File.OpenRead(modelPath))
6663using (var f = File.Open(outputPath, FileMode.Create, FileAccess.Write, FileShare.None))
Microsoft.ML.Data (8)
Microsoft.ML.EntryPoints (4)
Microsoft.ML.GenAI.Core.Tests (1)
Microsoft.ML.GenAI.LLaMA (3)
Microsoft.ML.GenAI.Mistral (3)
Microsoft.ML.GenAI.Phi (6)
Microsoft.ML.GenAI.Samples (1)
Microsoft.ML.ImageAnalytics (2)
Microsoft.ML.IntegrationTests (12)
Microsoft.ML.Maml (1)
Microsoft.ML.OnnxTransformer (4)
Microsoft.ML.OnnxTransformerTest (8)
Microsoft.ML.PerformanceTests (16)
Microsoft.ML.Predictor.Tests (8)
Microsoft.ML.ResultProcessor (4)
Microsoft.ML.Samples (34)
Microsoft.ML.Samples.GPU (22)
Microsoft.ML.SamplesUtils (1)
Microsoft.ML.Sweeper (4)
Microsoft.ML.TensorFlow (2)
Microsoft.ML.TensorFlow.Tests (13)
Microsoft.ML.TestFramework (43)
DataPipe\TestDataPipe.cs (19)
53File.WriteAllLines(mappingPathData,
73File.WriteAllLines(mappingPathData,
93File.WriteAllLines(mappingPathData,
113File.WriteAllLines(mappingPathData,
143File.WriteAllLines(mappingPathData,
169File.WriteAllLines(pathTerms, new string[] {
192File.WriteAllLines(pathTerms, new string[] {
250File.WriteAllLines(pathData, new string[] {
296File.WriteAllLines(pathData,
344File.WriteAllLines(dataFile, _small20NewsGroupSample);
347File.WriteAllLines(dictFile, _small20NewsGroupDict);
429File.WriteAllLines(pathData,
654File.WriteAllLines(pathData,
736File.WriteAllLines(pathData,
889File.WriteAllLines(dataFile, new[] {
908File.WriteAllLines(stopwordsFile, stopwordsList);
960File.WriteAllLines(dataFile, new[] {
984File.WriteAllLines(pathData,
1042File.WriteAllLines(pathData, new string[] {
Microsoft.ML.TestFrameworkCommon (8)
Microsoft.ML.Tests (81)
Microsoft.ML.TimeSeries (1)
Microsoft.ML.TimeSeries.Tests (5)
Microsoft.ML.Tokenizers (17)
Microsoft.ML.Tokenizers.Data.Tests (3)
Microsoft.ML.Tokenizers.Tests (69)
Microsoft.ML.Transforms (6)
Microsoft.ML.Vision (21)
Microsoft.NET.Build.Containers (10)
Microsoft.NET.Build.Extensions.Tasks (7)
Microsoft.NET.Build.Tasks (67)
Microsoft.NET.HostModel (23)
Microsoft.NET.Sdk.BlazorWebAssembly.Tasks (21)
Microsoft.NET.Sdk.BlazorWebAssembly.Tool (1)
Microsoft.NET.Sdk.Publish.Tasks (41)
Microsoft.NET.Sdk.Razor.Tasks (5)
Microsoft.NET.Sdk.StaticWebAssets.Tasks (106)
Microsoft.NET.Sdk.StaticWebAssets.Tool (1)
Microsoft.NET.Sdk.WorkloadManifestReader (22)
Microsoft.NET.Sdk.WorkloadMSBuildSdkResolver (9)
Microsoft.NETCore.Platforms (2)
Microsoft.SourceLink.Common (4)
Microsoft.TemplateEngine.Abstractions (12)
Microsoft.TemplateEngine.Cli (1)
Microsoft.TemplateEngine.Edge (1)
Microsoft.TemplateEngine.Utils (12)
Microsoft.TestPlatform.Build (1)
Microsoft.TestPlatform.CoreUtilities (5)
Microsoft.TestPlatform.CrossPlatEngine (2)
Microsoft.TestPlatform.Extensions.BlameDataCollector (5)
Microsoft.TestPlatform.PlatformAbstractions (7)
Microsoft.TestPlatform.TestHostRuntimeProvider (2)
Microsoft.TestPlatform.Utilities (1)
Microsoft.TestPlatform.VsTestConsole.TranslationLayer (1)
Microsoft.VisualBasic.Core (27)
Microsoft.VisualBasic.Forms (1)
Microsoft.VisualStudio.TestPlatform.Common (4)
Microsoft.VisualStudio.TestPlatform.Extensions.Trx.TestLogger (5)
Microsoft.VisualStudio.TestPlatform.ObjectModel (3)
Microsoft.Web.XmlTransform (2)
Mono.Cecil (6)
Mono.Cecil.Mdb (1)
Mono.Cecil.Pdb (3)
MSBuild (6)
mscorlib (1)
netstandard (1)
NuGet.Build.Tasks (3)
NuGet.Build.Tasks.Pack (7)
NuGet.CommandLine.XPlat (14)
NuGet.Commands (28)
NuGet.Common (15)
NuGet.Configuration (8)
NuGet.PackageManagement (41)
NuGet.Packaging (47)
PackageExtractor.cs (19)
419if (!File.Exists(nupkgMetadataFilePath))
512File.WriteAllText(tempHashPath, packageHash);
550File.Move(targetTempNupkg, targetNupkg);
556File.Delete(targetTempNupkg);
571File.Move(tempHashPath, hashPath);
573File.Move(tempNupkgMetadataPath, nupkgMetadataFilePath);
614if (File.Exists(targetTempNupkg))
616File.Delete(targetTempNupkg);
695if (!File.Exists(nupkgMetadataFilePath))
801File.Move(extractedNuspecFilePath, tempNuspecFilePath);
802File.Move(tempNuspecFilePath, targetNuspec);
805else if (!File.Exists(targetNuspec))
807File.Move(extractedNuspecFilePath, targetNuspec);
831File.WriteAllText(tempHashPath, packageHash);
853File.Move(targetTempNupkg, targetNupkg);
860File.Delete(targetTempNupkg);
875File.Move(tempHashPath, hashPath);
877File.Move(tempNupkgMetadataFilePath, nupkgMetadataFilePath);
965if (File.Exists(nupkgFilePath))
NuGet.ProjectModel (5)
NuGet.Protocol (55)
Pipelines.AppHost (1)
Pipelines.Library (3)
PresentationBuildTasks (20)
PresentationCore (4)
PresentationFramework (9)
PresentationUI (23)
MS\Internal\Documents\Application\DocumentStream.cs (19)
118File.Copy(sourcePath, copiesPath, true);
123FileAttributes attrib = File.GetAttributes(copiesPath);
126File.SetAttributes(copiesPath, attrib ^ FileAttributes.ReadOnly);
264File.Copy(sourcePath, tempPath, true);
315if (File.Exists(path))
317attributes = File.GetAttributes(path);
689File.Delete(path);
750File.SetAttributes(
854if (File.Exists(targetFile))
865if( File.Exists( backupFile ) )
868File.SetAttributes(backupFile, FileAttributes.Normal);
869File.Delete(backupFile);
874targetAttributes = File.GetAttributes(targetFile);
875File.Move(targetFile, backupFile);
889File.SetAttributes(backupFile, FileAttributes.Normal);
892File.Move(sourceFile, targetFile);
907File.Move(backupFile, targetFile);
914File.SetAttributes(targetFile, targetAttributes);
925File.Delete(backupFile);
RepoTasks (35)
Roslyn.Diagnostics.Analyzers (5)
rzc (18)
sdk-tasks (41)
Security.TransportSecurity.IntegrationTests (1)
SelectTests (16)
Stress.ApiService (2)
SuperFileCheck (3)
System.CodeDom (5)
System.CommandLine (2)
System.ComponentModel.TypeConverter (1)
System.Configuration.ConfigurationManager (21)
System.Diagnostics.EventLog (2)
System.Diagnostics.FileVersionInfo (2)
System.Diagnostics.PerformanceCounter (2)
System.Diagnostics.Process (19)
System.Diagnostics.StackTrace (1)
System.Diagnostics.TraceSource (1)
System.Drawing.Common (6)
System.Formats.Tar (12)
System.IO.Compression.ZipFile (8)
System.IO.FileSystem (1)
System.IO.FileSystem.DriveInfo (2)
System.IO.FileSystem.Watcher (1)
System.IO.IsolatedStorage (7)
System.IO.MemoryMappedFiles (4)
System.IO.Pipes (2)
System.IO.Ports (3)
System.Memory.Data (2)
System.Net.Mail (1)
System.Net.NameResolution (1)
System.Net.NetworkInformation (11)
System.Net.Ping (3)
System.Net.Quic (1)
System.Net.Security (1)
System.Net.Sockets (3)
System.Net.WebClient (1)
System.Private.CoreLib (35)
System.Private.Windows.Core.TestUtilities (5)
System.Private.Xml (3)
System.Reflection.MetadataLoadContext (3)
System.Runtime (1)
System.Runtime.Caching (1)
System.Security.Cryptography (9)
System.Speech (1)
System.Windows.Forms (6)
System.Windows.Forms.Design (2)
System.Windows.Forms.Primitives (1)
testhost (2)
testhost.arm64 (2)
testhost.x86 (2)
TypeScriptApiCompat (5)
vbc (6)
VBCSCompiler (25)
src\roslyn\src\Compilers\Server\VBCSCompiler\CompilationCache.cs (18)
157if (!File.Exists(cachedAssemblyPath))
160if (entryMutex is null && !File.Exists(cachedAssemblyPath))
166if (!File.Exists(cachedAssemblyPath))
205return !File.Exists(Path.Combine(entryDir, cachedFileName));
220File.Copy(sourcePath, targetPath, overwrite: true);
221File.SetLastWriteTimeUtc(targetPath, outputTimestampUtc);
269if (!File.Exists(keyPath))
276var oldKey = File.ReadAllText(keyPath, Encoding.UTF8);
325File.Copy(outputFiles.AssemblyPath, Path.Combine(stagingDir, AssemblyFileName), overwrite: false);
331File.WriteAllText(Path.Combine(stagingDir, dllName + ".key"), deterministicKey, Encoding.UTF8);
332File.WriteAllText(Path.Combine(stagingDir, CreatedFileName), DateTimeOffset.UtcNow.ToString("O", CultureInfo.InvariantCulture));
369if (sourcePath is not null && File.Exists(sourcePath))
371File.Copy(sourcePath, destPath, overwrite: false);
460File.WriteAllText(path, DateTimeOffset.UtcNow.ToString("O", CultureInfo.InvariantCulture));
558if (File.Exists(lastUsedPath))
560var text = File.ReadAllText(lastUsedPath).Trim();
586if (File.Exists(createdPath))
588var text = File.ReadAllText(createdPath).Trim();
vstest.console (5)
vstest.console.arm64 (5)