88 references to _context
Aspire.Cli.Tests (88)
Agents\OpenCodeAgentClientTests.cs (88)
19var workingDirectory = _context.Project.CreateSubdirectory(Path.Combine("apps", "api")); 20var executionContext = TestExecutionContextHelper.CreateExecutionContext(workingDirectory, homeDirectory: _context.Home); 21var client = new OpenCodeAgentClient(executionContext, _context.Environment); 25var target = client.GetIntegrationConfigPath(AgentConfigurationScope.Project, _context.Project); 27Assert.True(client.HasIntegrationRegistration(_context.Project, AgentConfigurationScope.Project, TestContext.Current.CancellationToken)); 28Assert.Equal(Path.Combine(_context.Project.FullName, "opencode.jsonc"), target); 31var configured = await _context.ConfigureIntegrationAsync(AgentConfigurationScope.Project, [client]); 38Assert.Empty(_context.Home.EnumerateFileSystemInfos()); 46var lowerPath = Path.Combine(_context.Project.FullName, "opencode.json"); 47var ownerPath = Path.Combine(_context.Project.FullName, ".opencode", "opencode.json"); 57var result = await _context.ConfigureMcpAsync(_context.OpenCode, AgentConfigurationScope.Project); 74var json = Path.Combine(_context.Project.FullName, "opencode.json"); 84var result = await _context.ConfigureMcpAsync(_context.OpenCode, AgentConfigurationScope.Project); 103var directory = scope is AgentConfigurationScope.Project ? _context.Project.FullName : _context.OpenCodeDirectory; 110var result = await _context.ConfigureMcpAsync(_context.OpenCode, scope); 117Assert.Empty((scope is AgentConfigurationScope.Project ? _context.Home : _context.Project).EnumerateFileSystemInfos()); 125var json = Path.Combine(_context.Project.FullName, "opencode.json"); 132var result = await _context.ConfigureMcpAsync(_context.OpenCode, AgentConfigurationScope.Project); 144var path = Path.Combine(_context.Project.FullName, "opencode.json"); 147var result = await _context.ConfigureMcpAsync(_context.OpenCode, AgentConfigurationScope.Project); 156var path = Path.Combine(_context.Project.FullName, "opencode.json"); 158var result = await _context.ConfigureMcpAsync(_context.OpenCode, AgentConfigurationScope.Project); 172_context.SetVariable("OPENCODE_CONFIG_DIR", _context.OpenCodeDirectory); 174var results = await _context.ConfigureIntegrationAsync(scope, [_context.OpenCode]).DefaultTimeout(); 178var repeated = await _context.ConfigureIntegrationAsync(scope, [_context.OpenCode]); 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"); 196var results = await _context.ConfigureIntegrationAsync(AgentConfigurationScope.Project, [_context.OpenCode]); 214var path = Path.Combine(_context.Project.FullName, "opencode.json"); 222var results = await _context.ConfigureIntegrationAsync(AgentConfigurationScope.Project, [_context.OpenCode]); 240var path = Path.Combine(_context.Project.FullName, "opencode.json"); 250await AgentConfigurationTestContext.WriteAsync(Path.Combine(_context.OpenCodeDirectory, "opencode.json"), inherited); 253var results = await _context.ConfigureIntegrationAsync(AgentConfigurationScope.Project, [_context.OpenCode]); 257Assert.Equal(inherited, await File.ReadAllTextAsync(Path.Combine(_context.OpenCodeDirectory, "opencode.json"))); 265var path = Path.Combine(_context.Project.FullName, "opencode.json"); 266var global = Path.Combine(_context.OpenCodeDirectory, "opencode.json"); 275var results = await _context.ConfigureIntegrationAsync(AgentConfigurationScope.Project, [_context.OpenCode]); 291var path = Path.Combine(_context.Project.FullName, "opencode.json"); 293var results = await _context.ConfigureIntegrationAsync(AgentConfigurationScope.Project, [_context.OpenCode]); 297Assert.Empty(_context.Home.EnumerateFileSystemInfos()); 306var directory = scope is AgentConfigurationScope.Project ? _context.Project.FullName : _context.OpenCodeDirectory; 313var results = await _context.ConfigureIntegrationAsync(scope, [_context.OpenCode]); 329_context.SetVariable("OPENCODE_CONFIG_CONTENT", inline); 331var results = await _context.ConfigureIntegrationAsync(AgentConfigurationScope.Project, [_context.OpenCode]); 334Assert.Empty(_context.Project.EnumerateFileSystemInfos()); 335Assert.Empty(_context.Home.EnumerateFileSystemInfos()); 344? Path.Combine(_context.Project.FullName, "~", "custom-opencode") 345: Path.Combine(_context.Home.FullName, "custom-opencode"); 346_context.SetVariable("OPENCODE_CONFIG_DIR", relative ? Path.Combine("~", "custom-opencode") : customDirectory); 347var inherited = Path.Combine(_context.OpenCodeDirectory, "opencode.json"); 351var results = await _context.ConfigureIntegrationAsync(AgentConfigurationScope.Global, [_context.OpenCode]); 356Assert.Equal(_context.OpenCode.GetMcpConfigPath(AgentConfigurationScope.Global, _context.Project), result.TargetPath); 359Directory.EnumerateFiles(_context.Home.FullName, "*", SearchOption.AllDirectories) 360.Concat(Directory.EnumerateFiles(_context.Project.FullName, "*", SearchOption.AllDirectories)).Order()); 368var selected = Path.Combine(_context.Home.FullName, "selected", "custom.jsonc"); 369var customDirectory = Path.Combine(_context.Home.FullName, "custom-opencode"); 370_context.SetVariable("OPENCODE_CONFIG", selected); 371_context.SetVariable("OPENCODE_CONFIG_DIR", customDirectory); 373var normal = Path.Combine(_context.OpenCodeDirectory, "opencode.json"); 378var results = await _context.ConfigureIntegrationAsync(AgentConfigurationScope.Global, [_context.OpenCode]); 386Directory.EnumerateFiles(_context.Home.FullName, "*", SearchOption.AllDirectories).Order()); 387Assert.True(_context.OpenCode.HasIntegrationRegistration(_context.Project, AgentConfigurationScope.Project, TestContext.Current.CancellationToken)); 390public void Dispose() => _context.Dispose();