1 write to Project
Aspire.Cli.Tests (1)
Agents\AgentConfigurationTestContext.cs (1)
27
Project
= Workspace.CreateDirectory("project");
145 references to Project
Aspire.Cli.Tests (145)
Agents\AgentConfigurationTestContext.cs (4)
36
ExecutionContext = TestExecutionContextHelper.CreateExecutionContext(
Project
, homeDirectory: Home);
74
=> AgentConfiguration.ApplyRemoteAsync(clients,
Project
, scope, cancellationToken);
81
client.GetMcpConfigPath(scope,
Project
),
Project
, scope, edit, cancellationToken);
Agents\AgentConfigurationTests.cs (53)
32
var path = Path.Combine(_context.
Project
.FullName, "settings.json");
55
var path = Path.Combine(_context.
Project
.FullName, "settings.json");
81
var path = Path.Combine(_context.
Project
.FullName, "settings.json");
108
var path = Path.Combine(_context.
Project
.FullName, "settings.json");
133
var directory = Path.Combine(_context.
Project
.FullName, "missing");
143
Assert.Empty(Directory.GetFiles(_context.
Project
.FullName, "*", SearchOption.AllDirectories));
151
var path = Path.Combine(_context.
Project
.FullName, "settings.json");
163
Assert.Equal(existed ? [path] : [], Directory.GetFiles(_context.
Project
.FullName));
173
var path = Path.Combine(_context.
Project
.FullName, "settings.json");
188
Assert.Equal([path], Directory.GetFiles(_context.
Project
.FullName));
196
var path = _context.Copilot.GetIntegrationConfigPath(AgentConfigurationScope.Project, _context.
Project
);
205
config, _context.
Project
, AgentConfigurationScope.Project, edit, CancellationToken.None);
210
Assert.Equal([path], Directory.GetFiles(_context.
Project
.FullName, "*", SearchOption.AllDirectories));
220
var inherited = client.GetIntegrationConfigPath(AgentConfigurationScope.Global, _context.
Project
);
222
var path = client.GetIntegrationConfigPath(AgentConfigurationScope.Project, _context.
Project
);
226
config, _context.
Project
, AgentConfigurationScope.Project, edit, CancellationToken.None);
252
var path = _context.ClaudeCode.GetIntegrationConfigPath(AgentConfigurationScope.Project, _context.
Project
);
256
config, _context.
Project
, AgentConfigurationScope.Project, edit, CancellationToken.None);
272
Assert.Empty(Directory.GetFiles(_context.
Project
.FullName, "*", SearchOption.AllDirectories));
280
var path = _context.ClaudeCode.GetIntegrationConfigPath(AgentConfigurationScope.Project, _context.
Project
);
284
config, _context.
Project
, AgentConfigurationScope.Project, edit, CancellationToken.None);
295
var path = _context.OpenCode.GetIntegrationConfigPath(AgentConfigurationScope.Global, _context.
Project
);
300
remote, _context.
Project
, AgentConfigurationScope.Global, remoteEdit, CancellationToken.None);
303
path, _context.
Project
, AgentConfigurationScope.Global, mcpEdit, CancellationToken.None);
324
var path = Path.Combine(_context.
Project
.FullName, "settings.json");
325
var target = Path.Combine(_context.
Project
.FullName, "linked.json");
355
var path = Path.Combine(_context.
Project
.FullName, "settings.json");
356
var directory = _context.
Project
.GetAccessControl();
360
_context.
Project
.SetAccessControl(directory);
387
Assert.Equal([path], Directory.GetFiles(_context.
Project
.FullName));
401
var path = Path.Combine(_context.
Project
.FullName, "settings.json");
408
TestPosixAcl.SetDefault(_context.
Project
.FullName, "user::rwx,user:65534:r-x,group::---,mask::r-x,other::---");
423
Assert.Equal([path], Directory.GetFiles(_context.
Project
.FullName));
434
var path = Path.Combine(_context.
Project
.FullName, "settings.json");
461
var path = Path.Combine(_context.
Project
.FullName, "settings.json");
516
Assert.Equal([path], Directory.GetFiles(_context.
Project
.FullName));
525
Assert.Equal(Path.Combine(_context.
Project
.FullName, ".github", "copilot", "settings.json"),
538
var project = await File.ReadAllTextAsync(Path.Combine(_context.
Project
.FullName, ".github", "copilot", "settings.json")).DefaultTimeout();
541
Assert.False(Directory.Exists(Path.Combine(_context.
Project
.FullName, ".vscode")));
576
var project = await File.ReadAllTextAsync(Path.Combine(_context.
Project
.FullName, ".claude", "settings.json")).DefaultTimeout();
593
var path = local ? Path.Combine(_context.
Project
.FullName, ".claude", "settings.local.json")
594
: client.GetIntegrationConfigPath(AgentConfigurationScope.Global, _context.
Project
);
602
Directory.EnumerateFiles(_context.
Project
.FullName, "*", SearchOption.AllDirectories));
603
Assert.False(File.Exists(client.GetIntegrationConfigPath(AgentConfigurationScope.Project, _context.
Project
)));
616
var target = Path.Combine(_context.
Project
.FullName, ".claude", "settings.json");
636
Assert.Empty(_context.
Project
.EnumerateFileSystemInfos());
652
var target = Path.Combine(_context.
Project
.FullName, ".claude", "settings.json");
684
_context.SetVariable("COPILOT_HOME", Path.Combine(_context.
Project
.FullName, ".github", "copilot"));
689
Assert.Equal(Path.Combine(_context.
Project
.FullName, ".github", "copilot", "settings.json"), results[0].TargetPath);
690
Assert.Equal([results[0].TargetPath], Directory.EnumerateFiles(_context.
Project
.FullName, "*", SearchOption.AllDirectories));
734
var unreadable = Path.Combine(_context.
Project
.FullName, ".github", "copilot", "settings.json");
741
Assert.True(File.Exists(Path.Combine(_context.
Project
.FullName, ".claude", "settings.json")));
753
Assert.Empty(_context.
Project
.EnumerateFileSystemInfos());
Agents\AgentPathTests.cs (5)
31
Assert.Empty(_context.
Project
.EnumerateFileSystemInfos());
45
_context.Copilot.GetIntegrationConfigPath(AgentConfigurationScope.Global, _context.
Project
));
47
_context.Copilot.GetMcpConfigPath(AgentConfigurationScope.Global, _context.
Project
));
48
Assert.Empty(_context.
Project
.EnumerateFileSystemInfos());
55
Assert.Equal(Path.Combine(_context.
Project
.FullName, "~other-user"), AgentPath.Expand("~other-user", _context.ExecutionContext));
Agents\LocalAspireSkillsTests.cs (24)
26
var paths = names.Select(name => Path.Combine(_context.
Project
.FullName, ".agents", "skills", name, "SKILL.md")).ToArray();
49
var path = Path.Combine(_context.
Project
.FullName, directory, "skills", "aspire", "SKILL.md");
52
var empty = Path.Combine(_context.
Project
.FullName, directory, "skills", "aspire-init", "SKILL.md");
55
await AgentConfigurationTestContext.WriteAsync(Path.Combine(_context.
Project
.FullName, directory, "skills", "aspire-custom", "SKILL.md"), "unrelated");
56
await AgentConfigurationTestContext.WriteAsync(Path.Combine(_context.
Project
.FullName, directory, "skills", "playwright-cli", "SKILL.md"), "unrelated");
72
var project = Path.Combine(_context.
Project
.FullName, ".agents", "skills", "aspire-init", "SKILL.md");
91
await AgentConfigurationTestContext.WriteAsync(Path.Combine(_context.
Project
.FullName, ".github", "skills", "aspire", "SKILL.md"), "other agent");
106
Path.Combine(_context.
Project
.FullName, ".opencode", "skill", "aspire", "SKILL.md"),
129
: Path.Combine(_context.
Project
.FullName, ".opencode", "opencode.jsonc");
132
Path.Combine(_context.
Project
.FullName, "team-skills", "aspire", "SKILL.md"),
161
var path = Path.Combine(_context.
Project
.FullName, "opencode.json");
176
await AgentConfigurationTestContext.WriteAsync(Path.Combine(_context.
Project
.FullName, "unrelated", ".agents", "skills", "aspire", "SKILL.md"), "unrelated");
193
var parent = _context.
Project
.CreateSubdirectory("apps");
195
var paths = new[] { _context.
Project
, parent, working }
207
var result = LocalAspireSkills.Find(working, _context.
Project
,
219
var selected = Path.Combine(_context.
Project
.FullName, ".agents", "skills", "aspire", "SKILL.md");
224
var result = LocalAspireSkills.Find(outside, _context.
Project
, [_context.OpenCode],
234
var path = Path.Combine(_context.
Project
.FullName, ".agents", "skills", "aspire", "SKILL.md");
236
await AgentConfigurationTestContext.WriteAsync(Path.Combine(_context.
Project
.FullName, ".agents", "skills", "aspireify", "SKILL.md"), "readable");
250
LocalAspireSkills.Find(_context.
Project
, _context.
Project
, _context.Clients, new CancellationToken(canceled: true)));
251
Assert.Empty(_context.
Project
.EnumerateFileSystemInfos());
256
=> LocalAspireSkills.Find(_context.
Project
, _context.
Project
, agents, TestContext.Current.CancellationToken);
Agents\OpenCodeAgentClientTests.cs (25)
19
var workingDirectory = _context.
Project
.CreateSubdirectory(Path.Combine("apps", "api"));
25
var target = client.GetIntegrationConfigPath(AgentConfigurationScope.Project, _context.
Project
);
27
Assert.True(client.HasIntegrationRegistration(_context.
Project
, AgentConfigurationScope.Project, TestContext.Current.CancellationToken));
28
Assert.Equal(Path.Combine(_context.
Project
.FullName, "opencode.jsonc"), target);
46
var lowerPath = Path.Combine(_context.
Project
.FullName, "opencode.json");
47
var ownerPath = Path.Combine(_context.
Project
.FullName, ".opencode", "opencode.json");
74
var json = Path.Combine(_context.
Project
.FullName, "opencode.json");
103
var directory = scope is AgentConfigurationScope.Project ? _context.
Project
.FullName : _context.OpenCodeDirectory;
117
Assert.Empty((scope is AgentConfigurationScope.Project ? _context.Home : _context.
Project
).EnumerateFileSystemInfos());
125
var json = Path.Combine(_context.
Project
.FullName, "opencode.json");
144
var path = Path.Combine(_context.
Project
.FullName, "opencode.json");
156
var path = Path.Combine(_context.
Project
.FullName, "opencode.json");
184
Assert.Empty((scope is AgentConfigurationScope.Project ? _context.Home : _context.
Project
).EnumerateFileSystemInfos());
190
var root = Path.Combine(_context.
Project
.FullName, "opencode.jsonc");
193
var path = Path.Combine(_context.
Project
.FullName, ".opencode", "opencode.jsonc");
214
var path = Path.Combine(_context.
Project
.FullName, "opencode.json");
240
var path = Path.Combine(_context.
Project
.FullName, "opencode.json");
265
var path = Path.Combine(_context.
Project
.FullName, "opencode.json");
291
var path = Path.Combine(_context.
Project
.FullName, "opencode.json");
306
var directory = scope is AgentConfigurationScope.Project ? _context.
Project
.FullName : _context.OpenCodeDirectory;
334
Assert.Empty(_context.
Project
.EnumerateFileSystemInfos());
344
? Path.Combine(_context.
Project
.FullName, "~", "custom-opencode")
356
Assert.Equal(_context.OpenCode.GetMcpConfigPath(AgentConfigurationScope.Global, _context.
Project
), result.TargetPath);
360
.Concat(Directory.EnumerateFiles(_context.
Project
.FullName, "*", SearchOption.AllDirectories)).Order());
387
Assert.True(_context.OpenCode.HasIntegrationRegistration(_context.
Project
, AgentConfigurationScope.Project, TestContext.Current.CancellationToken));
Commands\AgentInitClientSelectionTests.cs (4)
1339
var projectSkillPath = Path.Combine(context.
Project
.FullName, projectDirectory, "skills", "aspire-init", "SKILL.md");
1380
Assert.True(File.Exists(context.Copilot.GetIntegrationConfigPath(AgentConfigurationScope.Global, context.
Project
)));
1381
Assert.True(File.Exists(context.Copilot.GetMcpConfigPath(AgentConfigurationScope.Global, context.
Project
)));
1382
Assert.False(File.Exists(context.ClaudeCode.GetIntegrationConfigPath(AgentConfigurationScope.Global, context.
Project
)));
Commands\AgentInitCommandTests.cs (30)
100
await File.WriteAllTextAsync(Path.Combine(context.
Project
.FullName, "apphost.cs"), string.Empty);
131
Assert.Equal(expectSourcePrompt, File.Exists(context.Copilot.GetIntegrationConfigPath(AgentConfigurationScope.Project, context.
Project
)));
132
Assert.False(File.Exists(Path.Combine(context.
Project
.FullName, ".mcp.json")));
164
Assert.Empty(context.
Project
.EnumerateFileSystemInfos());
201
Assert.Equal(remote, File.Exists(context.Copilot.GetIntegrationConfigPath(AgentConfigurationScope.Project, context.
Project
)));
202
Assert.Equal(!remote, File.Exists(Path.Combine(context.
Project
.FullName, ".agents", "skills", "aspire", "SKILL.md")));
210
await File.WriteAllTextAsync(Path.Combine(context.
Project
.FullName, "apphost.cs"), string.Empty);
580
Assert.True(File.Exists(client.GetIntegrationConfigPath(configurationScope, context.
Project
)));
582
context.
Project
, configurationScope, TestContext.Current.CancellationToken));
584
var skillsRoot = configurationScope is AgentConfigurationScope.Project ? context.
Project
: context.Home;
940
var global = client.GetIntegrationConfigPath(AgentConfigurationScope.Global, context.
Project
);
944
var project = client.GetIntegrationConfigPath(AgentConfigurationScope.Project, context.
Project
);
948
"claude" => Path.Combine(context.
Project
.FullName, ".claude", "settings.json"),
967
Assert.True(File.Exists(Path.Combine(client.GetSkillBaseDirectory(AgentConfigurationScope.Project, context.
Project
), "scope-test", "SKILL.md")));
1131
var root = scope == "project" ? context.
Project
: context.Home;
1132
var otherRoot = scope == "project" ? context.Home : context.
Project
;
1174
var scopeRoot = scope is AgentConfigurationScope.Project ? context.
Project
: context.Home;
1177
$"{client.DisplayName}: {prefix}{Path.GetRelativePath(scopeRoot.FullName, client.GetIntegrationConfigPath(scope, context.
Project
)).Replace(Path.DirectorySeparatorChar, '/')}").ToArray();
1205
client.GetIntegrationConfigPath(AgentConfigurationScope.Project, context.
Project
), original);
1226
client.GetIntegrationConfigPath(AgentConfigurationScope.Project, context.
Project
)));
1237
var path = Path.Combine(context.
Project
.FullName, "opencode.json");
1264
Assert.Equal([path], context.
Project
.EnumerateFiles().Select(file => file.FullName));
1274
var configPath = Path.Combine(context.
Project
.FullName, ".opencode", "opencode.jsonc");
1275
var skillPath = Path.Combine(context.
Project
.FullName, "team-skills", "aspire", "SKILL.md");
1313
var path = context.OpenCode.GetMcpConfigPath(scope, context.
Project
);
1331
Assert.True(File.Exists(context.Copilot.GetMcpConfigPath(scope, context.
Project
)));
1345
var integrationPath = client.GetIntegrationConfigPath(AgentConfigurationScope.Project, context.
Project
);
1361
client.GetMcpConfigPath(AgentConfigurationScope.Project, context.
Project
)))!;
1364
Assert.True(File.Exists(context.Copilot.GetIntegrationConfigPath(AgentConfigurationScope.Project, context.
Project
)));
1365
Assert.True(File.Exists(context.Copilot.GetMcpConfigPath(AgentConfigurationScope.Project, context.
Project
)));