Samples fixes (#5169)

This commit is contained in:
westey
2026-04-09 09:46:20 +01:00
committed by GitHub
Unverified
parent 30a2bc3dcb
commit 79afda1a6c
3 changed files with 22 additions and 3 deletions
+2 -2
View File
@@ -246,7 +246,7 @@ internal static class AgentsSamples
ExpectedOutputDescription =
[
"The output should contain information about both the current time and the weather in Seattle.",
"The weather information should reference the plugin result: cloudy with a high of 15°C.",
"The weather information should be similar to: cloudy with a high of 15°C. Exact phrasing may vary.",
"The output should not contain error messages or stack traces.",
],
},
@@ -521,7 +521,7 @@ internal static class AgentsSamples
OptionalEnvironmentVariables = ["AZURE_AI_MODEL_DEPLOYMENT_NAME"],
ExpectedOutputDescription =
[
"The output should demonstrate server-side conversation sessions with non-streaming and streaming turns.",
"The output should contain multiple joke responses showing a multi-turn conversation.",
"The output should not contain error messages or stack traces.",
],
},
@@ -168,7 +168,7 @@ public sealed class FileSystemJsonCheckpointStore : JsonCheckpointStore, IDispos
string filePath = Path.Combine(this.Directory.FullName, fileName);
if (!this.CheckpointIndex.Contains(key) ||
!File.Exists(fileName))
!File.Exists(filePath))
{
throw new KeyNotFoundException($"Checkpoint '{key.CheckpointId}' not found in store at '{this.Directory.FullName}'.");
}
@@ -178,4 +178,23 @@ public sealed class FileSystemJsonCheckpointStoreTests
Func<Task> createCheckpointAction = async () => await store.CreateCheckpointAsync(runId, TestData);
await createCheckpointAction.Should().NotThrowAsync();
}
[Fact]
public async Task RetrieveCheckpointAsync_ShouldReturnPersistedDataAsync()
{
// Arrange
using TempDirectory tempDirectory = new();
using FileSystemJsonCheckpointStore store = new(tempDirectory);
string sessionId = Guid.NewGuid().ToString("N");
JsonElement originalData = JsonSerializer.SerializeToElement(new { name = "test", value = 42 });
// Act
CheckpointInfo checkpoint = await store.CreateCheckpointAsync(sessionId, originalData);
JsonElement retrieved = await store.RetrieveCheckpointAsync(sessionId, checkpoint);
// Assert
retrieved.GetProperty("name").GetString().Should().Be("test");
retrieved.GetProperty("value").GetInt32().Should().Be(42);
}
}