< Summary

Information
Class: NexusLabs.Needlr.AgentFramework.Testing.ScenarioVerificationException
Assembly: NexusLabs.Needlr.AgentFramework.Testing
File(s): /home/runner/work/needlr/needlr/src/NexusLabs.Needlr.AgentFramework.Testing/IAgentScenario.cs
Line coverage
100%
Covered lines: 4
Uncovered lines: 0
Coverable lines: 4
Total lines: 68
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_ScenarioName()100%11100%
.ctor(...)100%11100%

File(s)

/home/runner/work/needlr/needlr/src/NexusLabs.Needlr.AgentFramework.Testing/IAgentScenario.cs

#LineLine coverage
 1using NexusLabs.Needlr.AgentFramework.Diagnostics;
 2using NexusLabs.Needlr.AgentFramework.Workspace;
 3
 4namespace NexusLabs.Needlr.AgentFramework.Testing;
 5
 6/// <summary>
 7/// Defines a self-contained agent test scenario with seed → execute → verify lifecycle.
 8/// Scenarios are discovered automatically when registered via DI.
 9/// </summary>
 10/// <remarks>
 11/// <para>
 12/// Each scenario declares its own system prompt, user prompt, and workspace seed data.
 13/// The <see cref="AgentScenarioRunner"/> handles workspace creation, context scoping,
 14/// diagnostics capture, and invokes <see cref="Verify"/> after execution.
 15/// </para>
 16/// <para>
 17/// For multi-agent pipeline scenarios, consumers can implement custom runner logic
 18/// that coordinates multiple agents using the scenario's prompts and workspace.
 19/// </para>
 20/// </remarks>
 21public interface IAgentScenario
 22{
 23    /// <summary>Gets the scenario name (used for selection and reporting).</summary>
 24    string Name { get; }
 25
 26    /// <summary>Gets a human-readable description of what the scenario tests.</summary>
 27    string Description { get; }
 28
 29    /// <summary>Gets the system prompt (agent instructions) for this scenario.</summary>
 30    string SystemPrompt { get; }
 31
 32    /// <summary>Gets the user message that starts the agent run.</summary>
 33    string UserPrompt { get; }
 34
 35    /// <summary>
 36    /// Populates the workspace with files needed before the agent runs.
 37    /// Called by the runner before execution begins.
 38    /// </summary>
 39    /// <param name="workspace">The workspace to seed with test data.</param>
 40    void SeedWorkspace(IWorkspace workspace);
 41
 42    /// <summary>
 43    /// Verifies the scenario's expected outcomes after the agent run completes.
 44    /// Throw an exception (e.g., <see cref="ScenarioVerificationException"/>) to indicate failure.
 45    /// </summary>
 46    /// <param name="workspace">The workspace after agent execution (contains any files the agent wrote).</param>
 47    /// <param name="diagnostics">
 48    /// Diagnostics from the run, or <see langword="null"/> if diagnostics were not captured.
 49    /// </param>
 50    void Verify(IWorkspace workspace, IAgentRunDiagnostics? diagnostics);
 51}
 52
 53/// <summary>
 54/// Thrown when a scenario's <see cref="IAgentScenario.Verify"/> method detects a failure.
 55/// </summary>
 56public sealed class ScenarioVerificationException : Exception
 57{
 58    /// <summary>Gets the scenario that failed.</summary>
 159    public string ScenarioName { get; }
 60
 61    /// <param name="scenarioName">Name of the scenario.</param>
 62    /// <param name="message">Description of the verification failure.</param>
 63    public ScenarioVerificationException(string scenarioName, string message)
 464        : base($"Scenario '{scenarioName}' failed: {message}")
 65    {
 466        ScenarioName = scenarioName;
 467    }
 68}