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
This commit is contained in:
Joseph Doherty
2026-01-19 11:05:36 -05:00
parent 08f5aa1447
commit 604bfe919c
148 changed files with 8696 additions and 1538 deletions
@@ -1,6 +1,7 @@
using JdeScoping.Api.Hubs;
using JdeScoping.Core.ViewModels;
using Microsoft.AspNetCore.SignalR;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.Logging;
using NSubstitute;
using Shouldly;
@@ -9,13 +10,17 @@ namespace JdeScoping.Api.Tests.Hubs;
public class StatusHubTests
{
private readonly IMemoryCache _cache;
private readonly ILogger<StatusHub> _logger;
private readonly TimeProvider _timeProvider;
private readonly StatusHub _hub;
public StatusHubTests()
{
_cache = new MemoryCache(new MemoryCacheOptions());
_logger = Substitute.For<ILogger<StatusHub>>();
_hub = new StatusHub(_logger);
_timeProvider = TimeProvider.System;
_hub = new StatusHub(_cache, _logger, _timeProvider);
}
[Fact]
@@ -47,34 +52,33 @@ public class StatusHubTests
"statusUpdate",
Arg.Is<object?[]>(args => args.Length == 1 && args[0] == statusUpdate),
Arg.Any<CancellationToken>());
// Assert - verify status was cached
var cachedStatus = _hub.GetCachedStatus();
cachedStatus.Message.ShouldBe("Processing");
}
[Fact]
public void GetCachedStatus_ReturnsLastSetStatus()
{
// The hub uses a static cached status, so this test checks the initial state
// Note: Due to static state, tests may affect each other if run in parallel
// Act
var status = _hub.GetCachedStatus();
// Assert
status.ShouldNotBeNull();
// Initial message is "Unknown"
status.Message.ShouldNotBeNullOrEmpty();
status.Message.ShouldBe("Unknown");
}
[Fact]
public void GetCachedStatus_InitialStatusIsUnknown()
{
// This test verifies the default initial state
// Note: This test assumes no other test has modified the static state
// Act
var status = _hub.GetCachedStatus();
// Assert
status.ShouldNotBeNull();
status.Message.ShouldBe("Unknown");
// The timestamp should be set
status.Timestamp.ShouldNotBe(default);
}