Files
Joseph Doherty 604bfe919c refactor: address code review findings across all projects
Apply comprehensive fixes from code reviews including:
- Extract shared utilities (SqlFormatHelper, CellValueConverter, DbDestinationBase)
- Add interface abstractions (IAuthenticationService, IDatabaseMigrator, IMisQueryBuilder)
- Implement SecureStore for encrypted secrets storage
- Fix error handling with proper HTTP status codes and logging
- Optimize double enumeration in DevEtlRegistry
- Add DataSync.Dev README for developer onboarding
- Extract filter panel base classes to reduce duplication
- Update code review docs to mark all issues as fixed
2026-01-19 11:05:36 -05:00

61 lines
1.6 KiB
C#

using JdeScoping.Core.Interfaces;
namespace JdeScoping.Infrastructure.Tests.Helpers;
/// <summary>
/// In-memory implementation of ISecureStoreService for unit testing.
/// </summary>
public class InMemorySecureStore : ISecureStoreService
{
private readonly Dictionary<string, string> _secrets = new();
private bool _disposed;
public string? Get(string key)
{
ObjectDisposedException.ThrowIf(_disposed, this);
return _secrets.TryGetValue(key, out var value) ? value : null;
}
public string GetRequired(string key)
{
ObjectDisposedException.ThrowIf(_disposed, this);
if (!_secrets.TryGetValue(key, out var value))
throw new KeyNotFoundException($"Secret '{key}' not found.");
return value;
}
public void Set(string key, string value)
{
ObjectDisposedException.ThrowIf(_disposed, this);
_secrets[key] = value;
}
public bool Contains(string key)
{
ObjectDisposedException.ThrowIf(_disposed, this);
return _secrets.ContainsKey(key);
}
public bool Remove(string key)
{
ObjectDisposedException.ThrowIf(_disposed, this);
return _secrets.Remove(key);
}
public void Save()
{
ObjectDisposedException.ThrowIf(_disposed, this);
// No-op for in-memory store
}
public IEnumerable<string> Keys => _secrets.Keys.ToList().AsReadOnly();
public void Dispose()
{
_disposed = true;
GC.SuppressFinalize(this);
}
}