1 write to Project
Aspire.Cli.Tests (1)
Agents\AgentConfigurationTestContext.cs (1)
30
Project
= Workspace.CreateDirectory("project");
199 references to Project
Aspire.Cli.Tests (199)
Agents\AgentConfigurationTestContext.cs (4)
39
ExecutionContext = TestExecutionContextHelper.CreateExecutionContext(
Project
, homeDirectory: Home);
80
=> AgentConfiguration.ApplyRemoteAsync(clients,
Project
, scope, Sources, cancellationToken);
87
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, _context.Sources, 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, _context.Sources, CancellationToken.None);
252
var path = _context.ClaudeCode.GetIntegrationConfigPath(AgentConfigurationScope.Project, _context.
Project
);
256
config, _context.
Project
, AgentConfigurationScope.Project, edit, _context.Sources, 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, _context.Sources, CancellationToken.None);
295
var path = _context.OpenCode.GetIntegrationConfigPath(AgentConfigurationScope.Global, _context.
Project
);
300
remote, _context.
Project
, AgentConfigurationScope.Global, remoteEdit, _context.Sources, 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);
692
Assert.Equal([results[0].TargetPath], Directory.EnumerateFiles(_context.
Project
.FullName, "*", SearchOption.AllDirectories));
738
var unreadable = Path.Combine(_context.
Project
.FullName, ".github", "copilot", "settings.json");
745
Assert.True(File.Exists(Path.Combine(_context.
Project
.FullName, ".claude", "settings.json")));
757
Assert.Empty(_context.
Project
.EnumerateFileSystemInfos());
Agents\AgentPathTests.cs (9)
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));
67
Assert.Equal(expected ?? path, AgentPath.GetDisplayPath(path, _context.
Project
, _context.ExecutionContext));
83
var projectPath = Path.Combine(_context.
Project
.FullName, "config.json");
85
Assert.Equal(homePath, AgentPath.GetDisplayPath(homePath, AgentConfigurationScope.Project, _context.
Project
, _context.ExecutionContext));
86
Assert.Equal(projectPath, AgentPath.GetDisplayPath(projectPath, AgentConfigurationScope.Global, _context.
Project
, _context.ExecutionContext));
Agents\LocalAspireSkillsTests.cs (16)
26
var skills = Path.Combine(_context.
Project
.FullName, ".agents", "skills");
35
var result = Find(_context.
Project
, _context.
Project
);
50
var parent = _context.
Project
.CreateSubdirectory("apps");
52
var paths = new[] { _context.
Project
, parent, working }
63
var result = Find(working, _context.
Project
);
73
var project = Path.Combine(_context.
Project
.FullName, ".agents", "skills", "aspire-init");
80
var result = Find(_context.
Project
, _context.
Project
);
103
await AgentConfigurationTestContext.WriteAsync(Path.Combine(_context.
Project
.FullName, "unrelated", ".agents", "skills", "aspire", "SKILL.md"), "unrelated");
105
Assert.Empty(Find(_context.
Project
, _context.
Project
));
112
var selected = Path.Combine(_context.
Project
.FullName, ".agents", "skills", "aspire");
117
var result = Find(outside, _context.
Project
);
126
LocalAspireSkills.Find(_context.
Project
, _context.
Project
, _context.Home, new CancellationToken(canceled: true)));
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, _context.Sources));
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, _context.Sources));
Agents\SkillSourceTests.cs (14)
211
context.OpenCode.GetIntegrationConfigPath(scope, context.
Project
),
221
Assert.True(client.HasIntegrationRegistration(context.
Project
, scope, context.Sources));
222
configurations[client.Id] = AgentConfiguration.ReadObject(client.GetIntegrationConfigPath(scope, context.
Project
));
236
var path = context.Copilot.GetIntegrationConfigPath(AgentConfigurationScope.Project, context.
Project
);
258
var path = client.GetIntegrationConfigPath(AgentConfigurationScope.Project, context.
Project
);
280
client.GetIntegrationConfigPath(AgentConfigurationScope.Project, context.
Project
),
283
Assert.True(client.HasIntegrationRegistration(context.
Project
, AgentConfigurationScope.Project, context.Sources));
298
var path = client.GetIntegrationConfigPath(AgentConfigurationScope.Project, context.
Project
);
320
var app = context.
Project
.CreateSubdirectory("app");
345
var path = client.GetIntegrationConfigPath(AgentConfigurationScope.Project, context.
Project
);
372
Assert.Empty(Directory.GetFiles(context.
Project
.FullName, "*", SearchOption.AllDirectories));
392
var path = client.GetIntegrationConfigPath(AgentConfigurationScope.Project, context.
Project
);
424
context.OpenCode.GetIntegrationConfigPath(AgentConfigurationScope.Project, context.
Project
), """{"skills":[]}""");
433
client.GetIntegrationConfigPath(AgentConfigurationScope.Project, context.
Project
));
Commands\AgentInitClientSelectionTests.cs (5)
1607
var projectSkillPath = Path.Combine(context.
Project
.FullName, projectDirectory, "skills", "aspire-init", "SKILL.md");
1641
Assert.True(File.Exists(context.Copilot.GetIntegrationConfigPath(AgentConfigurationScope.Global, context.
Project
)));
1642
Assert.True(File.Exists(context.Copilot.GetMcpConfigPath(AgentConfigurationScope.Global, context.
Project
)));
1643
Assert.False(File.Exists(context.ClaudeCode.GetIntegrationConfigPath(AgentConfigurationScope.Global, context.
Project
)));
1649
var mcpPath = context.Copilot.GetMcpConfigPath(AgentConfigurationScope.Global, context.
Project
);
Commands\AgentInitCommandTests.cs (66)
67
var first = context.
Project
.CreateSubdirectory("first");
68
var selected = context.
Project
.CreateSubdirectory("selected");
91
Assert.Equal(context.
Project
.FullName, directory.FullName);
107
context.Copilot.GetIntegrationConfigPath(AgentConfigurationScope.Project, context.
Project
)), "json")
164
var appHostDirectory = context.
Project
.CreateSubdirectory("app");
172
await AgentConfigurationTestContext.WriteAsync(Path.Combine(context.
Project
.FullName, "web", "Web.csproj"), """
178
await AgentConfigurationTestContext.WriteAsync(Path.Combine(context.
Project
.FullName, AspireConfigFile.FileName), """
198
context.
Project
, AppHostDiscoveryScope.DefaultFiltered, CancellationToken.None).DefaultTimeout());
201
context.
Project
, AppHostDiscoveryScope.ExplicitDirectory, maxDepth: 0,
204
context.
Project
, AppHostDiscoveryScope.ExplicitDirectory, maxDepth: 1,
216
context.Copilot.GetIntegrationConfigPath(AgentConfigurationScope.Project, context.
Project
)), "json")
248
await AgentConfigurationTestContext.WriteAsync(Path.Combine(context.
Project
.FullName, AspireConfigFile.FileName), """
281
client.GetIntegrationConfigPath(AgentConfigurationScope.Project, context.
Project
))));
327
await File.WriteAllTextAsync(Path.Combine(context.
Project
.FullName, "apphost.cs"), string.Empty);
454
Assert.True(File.Exists(client.GetIntegrationConfigPath(configurationScope, context.
Project
)));
456
context.
Project
, configurationScope, context.Sources));
458
var skillsRoot = configurationScope is AgentConfigurationScope.Project ? context.
Project
: context.Home;
504
var app = context.
Project
.CreateSubdirectory("app");
518
interaction, CliExitCodes.Success, context.
Project
, app,
527
var config = await File.ReadAllTextAsync(context.Copilot.GetIntegrationConfigPath(AgentConfigurationScope.Project, context.
Project
));
537
await AgentConfigurationTestContext.WriteAsync(Path.Combine(context.
Project
.FullName, "aspire.config.json"), """
540
await AgentConfigurationTestContext.WriteAsync(Path.Combine(context.
Project
.FullName, ".aspire", "settings.global.json"), """
546
options.WorkingDirectory = context.
Project
;
551
var app = sameDirectory ? context.
Project
: context.
Project
.CreateSubdirectory("app");
557
interaction, CliExitCodes.Success, context.
Project
, app,
567
context.Copilot.GetIntegrationConfigPath(AgentConfigurationScope.Project, context.
Project
)), "json")
835
var root = scope == "project" ? context.
Project
: context.Home;
836
var otherRoot = scope == "project" ? context.Home : context.
Project
;
873
var 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();
901
await AgentConfigurationTestContext.WriteAsync(Path.Combine(context.
Project
.FullName, "aspire.config.json"), """
934
context.OpenCode.GetIntegrationConfigPath(AgentConfigurationScope.Project, context.
Project
), config.ToJsonString());
960
client.GetIntegrationConfigPath(AgentConfigurationScope.Project, context.
Project
), original);
981
client.GetIntegrationConfigPath(AgentConfigurationScope.Project, context.
Project
)));
992
var path = Path.Combine(context.
Project
.FullName, "opencode.json");
1019
Assert.Equal([path], context.
Project
.EnumerateFiles().Select(file => file.FullName));
1029
var configPath = Path.Combine(context.
Project
.FullName, ".opencode", "opencode.jsonc");
1030
var skillDirectory = Path.Combine(context.
Project
.FullName, ".opencode", "skill", "aspire");
1031
var configuredSkillPath = Path.Combine(context.
Project
.FullName, "team-skills", "aspire", "SKILL.md");
1053
Assert.True(Directory.Exists(Path.Combine(context.
Project
.FullName, ".opencode", "skill")));
1075
var skillPath = Path.Combine(reason == "project-scope" ? context.Home.FullName : context.
Project
.FullName,
1079
var configPath = Path.Combine(context.
Project
.FullName, "aspire.config.json");
1084
context.Copilot.GetIntegrationConfigPath(AgentConfigurationScope.Project, context.
Project
),
1135
var skillDirectory = Path.Combine(context.
Project
.FullName, ".agents", "skills", "aspire");
1137
await AgentConfigurationTestContext.WriteAsync(Path.Combine(context.
Project
.FullName, "aspire.config.json"),
1142
var settingsPath = client.GetIntegrationConfigPath(AgentConfigurationScope.Project, context.
Project
);
1151
client.GetIntegrationConfigPath(AgentConfigurationScope.Global, context.
Project
), settings);
1179
var skillDirectory = Path.Combine(context.
Project
.FullName, ".agents", "skills", "aspire");
1221
var skillPath = Path.Combine(client.GetSkillBaseDirectory(scope, context.
Project
), "aspire", "SKILL.md");
1224
await AgentConfigurationTestContext.WriteAsync(Path.Combine(context.
Project
.FullName, "aspire.config.json"),
1226
await AgentConfigurationTestContext.WriteAsync(client.GetIntegrationConfigPath(scope, context.
Project
),
1230
? Path.Combine(context.
Project
.FullName, overridePath)
1250
Path.Combine(context.
Project
.FullName, skillRoot, "aspire", "SKILL.md"), "My customized Aspire instructions.");
1259
skillRoots.Where(skillRoot => Directory.Exists(Path.Combine(context.
Project
.FullName, skillRoot, "aspire"))));
1270
var linkPath = Path.Combine(context.
Project
.FullName, ".agents", "skills");
1296
context.
Project
, AgentConfigurationScope.Project, [SkillSource.BuiltIn]));
1308
var skillsDirectory = Path.Combine(context.
Project
.FullName, ".agents", "skills");
1355
Assert.Equal([failedDirectory], LocalAspireSkills.Find(context.
Project
, context.
Project
, context.Home, TestContext.Current.CancellationToken)
1366
var path = context.OpenCode.GetMcpConfigPath(scope, context.
Project
);
1383
Assert.True(File.Exists(context.Copilot.GetMcpConfigPath(scope, context.
Project
)));
1397
var integrationPath = client.GetIntegrationConfigPath(AgentConfigurationScope.Project, context.
Project
);
1414
client.GetMcpConfigPath(AgentConfigurationScope.Project, context.
Project
)))!;
1417
Assert.True(File.Exists(context.Copilot.GetIntegrationConfigPath(AgentConfigurationScope.Project, context.
Project
)));
1418
Assert.True(File.Exists(context.Copilot.GetMcpConfigPath(AgentConfigurationScope.Project, context.
Project
)));
Commands\ConfigSourceCommandTests.cs (3)
250
await sourceService.MaterializeAsync(s_source, context.
Project
, CancellationToken.None);
253
var path = Path.Combine(context.
Project
.FullName, AspireConfigFile.FileName);
275
await Verify(await File.ReadAllTextAsync(client.GetIntegrationConfigPath(AgentConfigurationScope.Project, context.
Project
)), "json")
Commands\DoctorCommandTests.cs (3)
42
var skills = new[] { context.
Project
, context.Home }
64
context.
Project
.FullName, JsonSourceGenerationContext.RelaxedEscaping.Options.Encoder).ToString();
77
foreach (var directory in new[] { context.
Project
, context.Home })
Utils\AspireSkillsCheckTests.cs (1)
25
var project = Path.Combine(_context.
Project
.FullName, ".claude", "skills", "aspire-init", "SKILL.md");