using Agent.Core.Logging;using Agent.Core.Ollama;using Xunit;namespace Agent.Core.DesignTests;/// <summary>Chat + history flows through <see cref="OllamaClient"/> without calling Ollama HTTP.</summary>public class OllamaClientHistoryTests{ [Fact] public void Save_and_load_conversation_round_trip() { string root = CreateTempHistoryRoot(); try { var logger = new Logger(); var client = new OllamaClient(logger, new ChatHistoryStore(root)) { Model = "gemma4" }; client.ClearHistory(); client.History.Add("user", "Hello from design tests"); client.History.Add("assistant", "Hello back", tokens: 4); client.SaveCurrentConversation(); client.StartNewSession(); client.ClearHistory(); Assert.DoesNotContain( client.History, m => !m.Role.Equals("system", StringComparison.OrdinalIgnoreCase)); IReadOnlyList<ChatSessionSummary> sessions = client.ListSavedConversations(); Assert.Single(sessions); Assert.True(client.LoadSavedConversation(1)); Assert.Contains(client.History, m => m.Content.Contains("Hello from design tests", StringComparison.Ordinal)); Assert.Contains(client.History, m => m.Content.Contains("Hello back", StringComparison.Ordinal)); } finally { TryDeleteDirectory(root); } } [Fact] public void LoadSavedConversation_returns_false_for_invalid_index() { string root = CreateTempHistoryRoot(); try { var client = new OllamaClient(new Logger(), new ChatHistoryStore(root)); Assert.False(client.LoadSavedConversation(99)); } finally { TryDeleteDirectory(root); } } private static string CreateTempHistoryRoot() { string path = Path.Combine(Path.GetTempPath(), "AgentCore-DesignTests", Guid.NewGuid().ToString("N")); Directory.CreateDirectory(path); return path; } private static void TryDeleteDirectory(string path) { try { if (Directory.Exists(path)) { Directory.Delete(path, recursive: true); } } catch { } }}
Documentation
Version 1 design tests
Automated checks for chat and saved history (/history, /new, XML sessions under %AppData%/AgentCore/Version 1/ChatHistory).
Quick run
# From repo root (builds + offline unit tests)
python src/Version1/DesignTests/run-design-tests.py
# With live Ollama chat (localhost:11434, model gemma4)
python src/Version1/DesignTests/run-design-tests.py --live
.\src\Version1\DesignTests\run-design-tests.ps1
.\src\Version1\DesignTests\run-design-tests.ps1 -Live
What runs
| Suite | Needs network | Covers | |-------|----------------|--------| | ChatHistoryStoreTests | No | Save, list, load, session ids | | OllamaClientHistoryTests | No | Client save/load without HTTP | | OllamaLiveTests | Yes (--live) | Real StreamReply against Ollama |
dotnet only
dotnet test src/Version1/DesignTests/AgentCore.DesignTests.csproj
dotnet test src/Version1/DesignTests/AgentCore.DesignTests.csproj --filter "Category=Integration"
Set RUN_LIVE_TESTS=1 for integration tests without the Python runner.
Console video (testers)
Manual evidence runs use the shared test manager (records Lilith.exe):
python src/TestManager/test_manager.py list
python src/TestManager/test_manager.py record v1 chat-basic --build
See src/TestManager/README.md.