namespace HrynCo.Common.Tests; using HrynCo.Common.Caching; using FluentAssertions; using Microsoft.Extensions.Caching.Memory; using Xunit; public sealed class CachingTests { [Fact] public async Task SessionCredentialStore_ShouldSaveGetAndRemoveValues() { using var cache = new MemoryCache(new MemoryCacheOptions()); var store = new InMemorySessionCredentialStore(cache); Guid userId = Guid.NewGuid(); await store.SaveAsync(userId, "github", "secret", TimeSpan.FromMinutes(5)); (await store.GetAsync(userId, "github")).Should().Be("secret"); await store.RemoveAsync(userId, "github"); (await store.GetAsync(userId, "github")).Should().BeNull(); } [Fact] public async Task SessionPromptStore_ShouldSaveGetAndRemoveValues() { using var cache = new MemoryCache(new MemoryCacheOptions()); var store = new InMemorySessionPromptStore(cache); Guid userId = Guid.NewGuid(); await store.SaveAsync(userId, "openai", "prompt", TimeSpan.FromMinutes(5)); (await store.GetAsync(userId, "openai")).Should().Be("prompt"); await store.RemoveAsync(userId, "openai"); (await store.GetAsync(userId, "openai")).Should().BeNull(); } }