chore: add hrynco common library solution

- add the standalone HrynCo.Common solution and projects
- include the shared common library source and tests
- add package metadata and a repo gitignore
This commit is contained in:
Anatolii Grynchuk
2026-05-01 00:17:34 +03:00
commit 85b362e8cd
38 changed files with 1452 additions and 0 deletions
+41
View File
@@ -0,0 +1,41 @@
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();
}
}