refactor(securestoremanager): add platform service abstractions and constants

Implement deferred code review findings:
- Add IDialogService/IClipboardService interfaces for testable platform operations
- Create AvaloniaDialogService and AvaloniaClipboardService implementations
- Extract dialog strings and file extensions to centralized Constants classes
- Refactor ViewModels to use DI instead of event delegates
- Update tests to use mock services
This commit is contained in:
Joseph Doherty
2026-01-19 16:54:35 -05:00
parent 1c546c111a
commit fbe58a81e4
33 changed files with 1790 additions and 298 deletions
@@ -9,12 +9,16 @@ namespace JdeScoping.SecureStoreManager.Tests.ViewModels;
public class MainWindowViewModelTests
{
private readonly ISecureStoreManager _mockStoreManager;
private readonly IDialogService _mockDialogService;
private readonly IClipboardService _mockClipboardService;
private readonly MainWindowViewModel _sut;
public MainWindowViewModelTests()
{
_mockStoreManager = Substitute.For<ISecureStoreManager>();
_sut = new MainWindowViewModel(_mockStoreManager);
_mockDialogService = Substitute.For<IDialogService>();
_mockClipboardService = Substitute.For<IClipboardService>();
_sut = new MainWindowViewModel(_mockStoreManager, _mockDialogService, _mockClipboardService);
}
[Fact]
@@ -280,7 +284,7 @@ public class MainWindowViewModelTests
};
// Act
_sut.SelectedSecret = new SecretItemViewModel("key", "value");
_sut.SelectedSecret = new SecretItemViewModel("key", "value", _mockClipboardService);
// Assert
propertyChangedRaised.ShouldBeTrue();