1 write to Project
Aspire.Cli.Tests (1)
Agents\AgentConfigurationTestContext.cs (1)
30Project = Workspace.CreateDirectory("project");
199 references to Project
Aspire.Cli.Tests (199)
Agents\AgentConfigurationTestContext.cs (4)
39ExecutionContext = TestExecutionContextHelper.CreateExecutionContext(Project, homeDirectory: Home); 80=> AgentConfiguration.ApplyRemoteAsync(clients, Project, scope, Sources, cancellationToken); 87client.GetMcpConfigPath(scope, Project), Project, scope, edit, cancellationToken);
Agents\AgentConfigurationTests.cs (53)
32var path = Path.Combine(_context.Project.FullName, "settings.json"); 55var path = Path.Combine(_context.Project.FullName, "settings.json"); 81var path = Path.Combine(_context.Project.FullName, "settings.json"); 108var path = Path.Combine(_context.Project.FullName, "settings.json"); 133var directory = Path.Combine(_context.Project.FullName, "missing"); 143Assert.Empty(Directory.GetFiles(_context.Project.FullName, "*", SearchOption.AllDirectories)); 151var path = Path.Combine(_context.Project.FullName, "settings.json"); 163Assert.Equal(existed ? [path] : [], Directory.GetFiles(_context.Project.FullName)); 173var path = Path.Combine(_context.Project.FullName, "settings.json"); 188Assert.Equal([path], Directory.GetFiles(_context.Project.FullName)); 196var path = _context.Copilot.GetIntegrationConfigPath(AgentConfigurationScope.Project, _context.Project); 205config, _context.Project, AgentConfigurationScope.Project, edit, _context.Sources, CancellationToken.None); 210Assert.Equal([path], Directory.GetFiles(_context.Project.FullName, "*", SearchOption.AllDirectories)); 220var inherited = client.GetIntegrationConfigPath(AgentConfigurationScope.Global, _context.Project); 222var path = client.GetIntegrationConfigPath(AgentConfigurationScope.Project, _context.Project); 226config, _context.Project, AgentConfigurationScope.Project, edit, _context.Sources, CancellationToken.None); 252var path = _context.ClaudeCode.GetIntegrationConfigPath(AgentConfigurationScope.Project, _context.Project); 256config, _context.Project, AgentConfigurationScope.Project, edit, _context.Sources, CancellationToken.None); 272Assert.Empty(Directory.GetFiles(_context.Project.FullName, "*", SearchOption.AllDirectories)); 280var path = _context.ClaudeCode.GetIntegrationConfigPath(AgentConfigurationScope.Project, _context.Project); 284config, _context.Project, AgentConfigurationScope.Project, edit, _context.Sources, CancellationToken.None); 295var path = _context.OpenCode.GetIntegrationConfigPath(AgentConfigurationScope.Global, _context.Project); 300remote, _context.Project, AgentConfigurationScope.Global, remoteEdit, _context.Sources, CancellationToken.None); 303path, _context.Project, AgentConfigurationScope.Global, mcpEdit, CancellationToken.None); 324var path = Path.Combine(_context.Project.FullName, "settings.json"); 325var target = Path.Combine(_context.Project.FullName, "linked.json"); 355var path = Path.Combine(_context.Project.FullName, "settings.json"); 356var directory = _context.Project.GetAccessControl(); 360_context.Project.SetAccessControl(directory); 387Assert.Equal([path], Directory.GetFiles(_context.Project.FullName)); 401var path = Path.Combine(_context.Project.FullName, "settings.json"); 408TestPosixAcl.SetDefault(_context.Project.FullName, "user::rwx,user:65534:r-x,group::---,mask::r-x,other::---"); 423Assert.Equal([path], Directory.GetFiles(_context.Project.FullName)); 434var path = Path.Combine(_context.Project.FullName, "settings.json"); 461var path = Path.Combine(_context.Project.FullName, "settings.json"); 516Assert.Equal([path], Directory.GetFiles(_context.Project.FullName)); 525Assert.Equal(Path.Combine(_context.Project.FullName, ".github", "copilot", "settings.json"), 538var project = await File.ReadAllTextAsync(Path.Combine(_context.Project.FullName, ".github", "copilot", "settings.json")).DefaultTimeout(); 541Assert.False(Directory.Exists(Path.Combine(_context.Project.FullName, ".vscode"))); 576var project = await File.ReadAllTextAsync(Path.Combine(_context.Project.FullName, ".claude", "settings.json")).DefaultTimeout(); 593var path = local ? Path.Combine(_context.Project.FullName, ".claude", "settings.local.json") 594: client.GetIntegrationConfigPath(AgentConfigurationScope.Global, _context.Project); 602Directory.EnumerateFiles(_context.Project.FullName, "*", SearchOption.AllDirectories)); 603Assert.False(File.Exists(client.GetIntegrationConfigPath(AgentConfigurationScope.Project, _context.Project))); 616var target = Path.Combine(_context.Project.FullName, ".claude", "settings.json"); 636Assert.Empty(_context.Project.EnumerateFileSystemInfos()); 652var target = Path.Combine(_context.Project.FullName, ".claude", "settings.json"); 684_context.SetVariable("COPILOT_HOME", Path.Combine(_context.Project.FullName, ".github", "copilot")); 689Assert.Equal(Path.Combine(_context.Project.FullName, ".github", "copilot", "settings.json"), results[0].TargetPath); 692Assert.Equal([results[0].TargetPath], Directory.EnumerateFiles(_context.Project.FullName, "*", SearchOption.AllDirectories)); 738var unreadable = Path.Combine(_context.Project.FullName, ".github", "copilot", "settings.json"); 745Assert.True(File.Exists(Path.Combine(_context.Project.FullName, ".claude", "settings.json"))); 757Assert.Empty(_context.Project.EnumerateFileSystemInfos());
Agents\AgentPathTests.cs (9)
31Assert.Empty(_context.Project.EnumerateFileSystemInfos()); 45_context.Copilot.GetIntegrationConfigPath(AgentConfigurationScope.Global, _context.Project)); 47_context.Copilot.GetMcpConfigPath(AgentConfigurationScope.Global, _context.Project)); 48Assert.Empty(_context.Project.EnumerateFileSystemInfos()); 55Assert.Equal(Path.Combine(_context.Project.FullName, "~other-user"), AgentPath.Expand("~other-user", _context.ExecutionContext)); 67Assert.Equal(expected ?? path, AgentPath.GetDisplayPath(path, _context.Project, _context.ExecutionContext)); 83var projectPath = Path.Combine(_context.Project.FullName, "config.json"); 85Assert.Equal(homePath, AgentPath.GetDisplayPath(homePath, AgentConfigurationScope.Project, _context.Project, _context.ExecutionContext)); 86Assert.Equal(projectPath, AgentPath.GetDisplayPath(projectPath, AgentConfigurationScope.Global, _context.Project, _context.ExecutionContext));
Agents\LocalAspireSkillsTests.cs (16)
26var skills = Path.Combine(_context.Project.FullName, ".agents", "skills"); 35var result = Find(_context.Project, _context.Project); 50var parent = _context.Project.CreateSubdirectory("apps"); 52var paths = new[] { _context.Project, parent, working } 63var result = Find(working, _context.Project); 73var project = Path.Combine(_context.Project.FullName, ".agents", "skills", "aspire-init"); 80var result = Find(_context.Project, _context.Project); 103await AgentConfigurationTestContext.WriteAsync(Path.Combine(_context.Project.FullName, "unrelated", ".agents", "skills", "aspire", "SKILL.md"), "unrelated"); 105Assert.Empty(Find(_context.Project, _context.Project)); 112var selected = Path.Combine(_context.Project.FullName, ".agents", "skills", "aspire"); 117var result = Find(outside, _context.Project); 126LocalAspireSkills.Find(_context.Project, _context.Project, _context.Home, new CancellationToken(canceled: true)));
Agents\OpenCodeAgentClientTests.cs (25)
19var workingDirectory = _context.Project.CreateSubdirectory(Path.Combine("apps", "api")); 25var target = client.GetIntegrationConfigPath(AgentConfigurationScope.Project, _context.Project); 27Assert.True(client.HasIntegrationRegistration(_context.Project, AgentConfigurationScope.Project, _context.Sources)); 28Assert.Equal(Path.Combine(_context.Project.FullName, "opencode.jsonc"), target); 46var lowerPath = Path.Combine(_context.Project.FullName, "opencode.json"); 47var ownerPath = Path.Combine(_context.Project.FullName, ".opencode", "opencode.json"); 74var json = Path.Combine(_context.Project.FullName, "opencode.json"); 103var directory = scope is AgentConfigurationScope.Project ? _context.Project.FullName : _context.OpenCodeDirectory; 117Assert.Empty((scope is AgentConfigurationScope.Project ? _context.Home : _context.Project).EnumerateFileSystemInfos()); 125var json = Path.Combine(_context.Project.FullName, "opencode.json"); 144var path = Path.Combine(_context.Project.FullName, "opencode.json"); 156var path = Path.Combine(_context.Project.FullName, "opencode.json"); 184Assert.Empty((scope is AgentConfigurationScope.Project ? _context.Home : _context.Project).EnumerateFileSystemInfos()); 190var root = Path.Combine(_context.Project.FullName, "opencode.jsonc"); 193var path = Path.Combine(_context.Project.FullName, ".opencode", "opencode.jsonc"); 214var path = Path.Combine(_context.Project.FullName, "opencode.json"); 240var path = Path.Combine(_context.Project.FullName, "opencode.json"); 265var path = Path.Combine(_context.Project.FullName, "opencode.json"); 291var path = Path.Combine(_context.Project.FullName, "opencode.json"); 306var directory = scope is AgentConfigurationScope.Project ? _context.Project.FullName : _context.OpenCodeDirectory; 334Assert.Empty(_context.Project.EnumerateFileSystemInfos()); 344? Path.Combine(_context.Project.FullName, "~", "custom-opencode") 356Assert.Equal(_context.OpenCode.GetMcpConfigPath(AgentConfigurationScope.Global, _context.Project), result.TargetPath); 360.Concat(Directory.EnumerateFiles(_context.Project.FullName, "*", SearchOption.AllDirectories)).Order()); 387Assert.True(_context.OpenCode.HasIntegrationRegistration(_context.Project, AgentConfigurationScope.Project, _context.Sources));
Agents\SkillSourceTests.cs (14)
211context.OpenCode.GetIntegrationConfigPath(scope, context.Project), 221Assert.True(client.HasIntegrationRegistration(context.Project, scope, context.Sources)); 222configurations[client.Id] = AgentConfiguration.ReadObject(client.GetIntegrationConfigPath(scope, context.Project)); 236var path = context.Copilot.GetIntegrationConfigPath(AgentConfigurationScope.Project, context.Project); 258var path = client.GetIntegrationConfigPath(AgentConfigurationScope.Project, context.Project); 280client.GetIntegrationConfigPath(AgentConfigurationScope.Project, context.Project), 283Assert.True(client.HasIntegrationRegistration(context.Project, AgentConfigurationScope.Project, context.Sources)); 298var path = client.GetIntegrationConfigPath(AgentConfigurationScope.Project, context.Project); 320var app = context.Project.CreateSubdirectory("app"); 345var path = client.GetIntegrationConfigPath(AgentConfigurationScope.Project, context.Project); 372Assert.Empty(Directory.GetFiles(context.Project.FullName, "*", SearchOption.AllDirectories)); 392var path = client.GetIntegrationConfigPath(AgentConfigurationScope.Project, context.Project); 424context.OpenCode.GetIntegrationConfigPath(AgentConfigurationScope.Project, context.Project), """{"skills":[]}"""); 433client.GetIntegrationConfigPath(AgentConfigurationScope.Project, context.Project));
Commands\AgentInitClientSelectionTests.cs (5)
1607var projectSkillPath = Path.Combine(context.Project.FullName, projectDirectory, "skills", "aspire-init", "SKILL.md"); 1641Assert.True(File.Exists(context.Copilot.GetIntegrationConfigPath(AgentConfigurationScope.Global, context.Project))); 1642Assert.True(File.Exists(context.Copilot.GetMcpConfigPath(AgentConfigurationScope.Global, context.Project))); 1643Assert.False(File.Exists(context.ClaudeCode.GetIntegrationConfigPath(AgentConfigurationScope.Global, context.Project))); 1649var mcpPath = context.Copilot.GetMcpConfigPath(AgentConfigurationScope.Global, context.Project);
Commands\AgentInitCommandTests.cs (66)
67var first = context.Project.CreateSubdirectory("first"); 68var selected = context.Project.CreateSubdirectory("selected"); 91Assert.Equal(context.Project.FullName, directory.FullName); 107context.Copilot.GetIntegrationConfigPath(AgentConfigurationScope.Project, context.Project)), "json") 164var appHostDirectory = context.Project.CreateSubdirectory("app"); 172await AgentConfigurationTestContext.WriteAsync(Path.Combine(context.Project.FullName, "web", "Web.csproj"), """ 178await AgentConfigurationTestContext.WriteAsync(Path.Combine(context.Project.FullName, AspireConfigFile.FileName), """ 198context.Project, AppHostDiscoveryScope.DefaultFiltered, CancellationToken.None).DefaultTimeout()); 201context.Project, AppHostDiscoveryScope.ExplicitDirectory, maxDepth: 0, 204context.Project, AppHostDiscoveryScope.ExplicitDirectory, maxDepth: 1, 216context.Copilot.GetIntegrationConfigPath(AgentConfigurationScope.Project, context.Project)), "json") 248await AgentConfigurationTestContext.WriteAsync(Path.Combine(context.Project.FullName, AspireConfigFile.FileName), """ 281client.GetIntegrationConfigPath(AgentConfigurationScope.Project, context.Project)))); 327await File.WriteAllTextAsync(Path.Combine(context.Project.FullName, "apphost.cs"), string.Empty); 454Assert.True(File.Exists(client.GetIntegrationConfigPath(configurationScope, context.Project))); 456context.Project, configurationScope, context.Sources)); 458var skillsRoot = configurationScope is AgentConfigurationScope.Project ? context.Project : context.Home; 504var app = context.Project.CreateSubdirectory("app"); 518interaction, CliExitCodes.Success, context.Project, app, 527var config = await File.ReadAllTextAsync(context.Copilot.GetIntegrationConfigPath(AgentConfigurationScope.Project, context.Project)); 537await AgentConfigurationTestContext.WriteAsync(Path.Combine(context.Project.FullName, "aspire.config.json"), """ 540await AgentConfigurationTestContext.WriteAsync(Path.Combine(context.Project.FullName, ".aspire", "settings.global.json"), """ 546options.WorkingDirectory = context.Project; 551var app = sameDirectory ? context.Project : context.Project.CreateSubdirectory("app"); 557interaction, CliExitCodes.Success, context.Project, app, 567context.Copilot.GetIntegrationConfigPath(AgentConfigurationScope.Project, context.Project)), "json") 835var root = scope == "project" ? context.Project : context.Home; 836var otherRoot = scope == "project" ? context.Home : context.Project; 873var scopeRoot = scope is AgentConfigurationScope.Project ? context.Project : context.Home; 876$"{prefix}{Path.GetRelativePath(scopeRoot.FullName, client.GetIntegrationConfigPath(scope, context.Project)).Replace(Path.DirectorySeparatorChar, '/')} ({client.DisplayName})").ToArray(); 901await AgentConfigurationTestContext.WriteAsync(Path.Combine(context.Project.FullName, "aspire.config.json"), """ 934context.OpenCode.GetIntegrationConfigPath(AgentConfigurationScope.Project, context.Project), config.ToJsonString()); 960client.GetIntegrationConfigPath(AgentConfigurationScope.Project, context.Project), original); 981client.GetIntegrationConfigPath(AgentConfigurationScope.Project, context.Project))); 992var path = Path.Combine(context.Project.FullName, "opencode.json"); 1019Assert.Equal([path], context.Project.EnumerateFiles().Select(file => file.FullName)); 1029var configPath = Path.Combine(context.Project.FullName, ".opencode", "opencode.jsonc"); 1030var skillDirectory = Path.Combine(context.Project.FullName, ".opencode", "skill", "aspire"); 1031var configuredSkillPath = Path.Combine(context.Project.FullName, "team-skills", "aspire", "SKILL.md"); 1053Assert.True(Directory.Exists(Path.Combine(context.Project.FullName, ".opencode", "skill"))); 1075var skillPath = Path.Combine(reason == "project-scope" ? context.Home.FullName : context.Project.FullName, 1079var configPath = Path.Combine(context.Project.FullName, "aspire.config.json"); 1084context.Copilot.GetIntegrationConfigPath(AgentConfigurationScope.Project, context.Project), 1135var skillDirectory = Path.Combine(context.Project.FullName, ".agents", "skills", "aspire"); 1137await AgentConfigurationTestContext.WriteAsync(Path.Combine(context.Project.FullName, "aspire.config.json"), 1142var settingsPath = client.GetIntegrationConfigPath(AgentConfigurationScope.Project, context.Project); 1151client.GetIntegrationConfigPath(AgentConfigurationScope.Global, context.Project), settings); 1179var skillDirectory = Path.Combine(context.Project.FullName, ".agents", "skills", "aspire"); 1221var skillPath = Path.Combine(client.GetSkillBaseDirectory(scope, context.Project), "aspire", "SKILL.md"); 1224await AgentConfigurationTestContext.WriteAsync(Path.Combine(context.Project.FullName, "aspire.config.json"), 1226await AgentConfigurationTestContext.WriteAsync(client.GetIntegrationConfigPath(scope, context.Project), 1230? Path.Combine(context.Project.FullName, overridePath) 1250Path.Combine(context.Project.FullName, skillRoot, "aspire", "SKILL.md"), "My customized Aspire instructions."); 1259skillRoots.Where(skillRoot => Directory.Exists(Path.Combine(context.Project.FullName, skillRoot, "aspire")))); 1270var linkPath = Path.Combine(context.Project.FullName, ".agents", "skills"); 1296context.Project, AgentConfigurationScope.Project, [SkillSource.BuiltIn])); 1308var skillsDirectory = Path.Combine(context.Project.FullName, ".agents", "skills"); 1355Assert.Equal([failedDirectory], LocalAspireSkills.Find(context.Project, context.Project, context.Home, TestContext.Current.CancellationToken) 1366var path = context.OpenCode.GetMcpConfigPath(scope, context.Project); 1383Assert.True(File.Exists(context.Copilot.GetMcpConfigPath(scope, context.Project))); 1397var integrationPath = client.GetIntegrationConfigPath(AgentConfigurationScope.Project, context.Project); 1414client.GetMcpConfigPath(AgentConfigurationScope.Project, context.Project)))!; 1417Assert.True(File.Exists(context.Copilot.GetIntegrationConfigPath(AgentConfigurationScope.Project, context.Project))); 1418Assert.True(File.Exists(context.Copilot.GetMcpConfigPath(AgentConfigurationScope.Project, context.Project)));
Commands\ConfigSourceCommandTests.cs (3)
250await sourceService.MaterializeAsync(s_source, context.Project, CancellationToken.None); 253var path = Path.Combine(context.Project.FullName, AspireConfigFile.FileName); 275await Verify(await File.ReadAllTextAsync(client.GetIntegrationConfigPath(AgentConfigurationScope.Project, context.Project)), "json")
Commands\DoctorCommandTests.cs (3)
42var skills = new[] { context.Project, context.Home } 64context.Project.FullName, JsonSourceGenerationContext.RelaxedEscaping.Options.Encoder).ToString(); 77foreach (var directory in new[] { context.Project, context.Home })
Utils\AspireSkillsCheckTests.cs (1)
25var project = Path.Combine(_context.Project.FullName, ".claude", "skills", "aspire-init", "SKILL.md");