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:
+6
-2
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user