Agent Framework tests and pass rates in C# with Claude A C# developer published a three-layer testing approach for Microsoft Agent Framework agents, separating deterministic code from model-driven decisions. The method unit-tests plain code, runs the agent against a scripted substitute model, then executes real scenarios against Claude Haiku 5.5 ten times each, reporting a pass rate and cost per scenario. The sample targets Microsoft Agent Framework 1.24.0, .NET 10 and xUnit v3, and depends only on IChatClient so the provider can be swapped. The idea: what code decides gets an ordinary test that passes or fails. What the model decides gets the same scenario run several times, a check on what the agent did, and a pass rate as the result. A kitchen assistant that keeps a shopping list makes two kinds of decisions. Some are made by code: the list stores items in lower case, refuses anything with "peanut" in its name and never holds the same item twice. Those behave the same on every run, and a unit test proves them. The others are made by the model: whether "Do we have eggs?" is a question or a request to buy eggs, and which ingredients a recipe still needs. Those can differ between two runs of the same request. This post tests the assistant in three layers: the code on its own, the agent with a scripted model in place of Claude, and real scenarios against Claude Haiku 5.5, each run ten times, with a pass rate and a cost per scenario. Versions: Microsoft Agent Framework 1.24.0, .NET 10, xUnit v3 4.0.1 xunit.v3.mtp-v2 , NSubstitute 6.2.0. Code: samples/agent-framework/14-testing-agents https://github.com/nkootstra/samples/tree/main/agent-framework/14-testing-agents , a runnable version of this post with its tests. Who this is for: C developers who have an agent with tools, as in Agent Framework tool calling in C with Claude https://kootstra.io/writing/tool-calling-ai-agents-csharp/ . Note The code runs on Claude Haiku 5.5, but it depends only on IChatClient : the first post https://kootstra.io/writing/microsoft-agent-framework-first-csharp-agent/ swap-the-provider-by-changing-one-statement shows the swap to OpenAI or Ollama. The costs use Haiku's list prices, which are constants in the test code; another model needs its own. The output limit of 4,096 tokens is sized for Haiku, which counts its reasoning as output. A console app with the two Agent Framework packages: dotnet new console -n KitchenScenarios cd KitchenScenarios dotnet add package Microsoft.Agents.AI --version 1.24.0 dotnet add package Microsoft.Agents.AI.Anthropic --version 1.24.0 The household's kitchen is one class, in Kitchen.cs , with a pantry to read and a shopping list to write: using System.ComponentModel; sealed class Kitchen { readonly Dictionary