diff --git a/MMExNotifier.Tests/MainViewModelTests.cs b/MMExNotifier.Tests/MainViewModelTests.cs index 9fc9b09..d46e953 100644 --- a/MMExNotifier.Tests/MainViewModelTests.cs +++ b/MMExNotifier.Tests/MainViewModelTests.cs @@ -120,5 +120,33 @@ public void OnDatabaseError_ShouldShowErrorMessage() mockNotificationService.Verify(); } + + + [Test] + public void SavingAppSettings_ShouldReloadExpiringBills() + { + mockDatabaseService.Setup(x => x.ExpiringBills).Returns( + new List + { + new() + { + BillId=1, + CategoryName="testCategory", + PayeeName="TestPayee", + NextOccurrenceDate=new DateTime(2024,6,1) + } + }); + + mockNotificationService.Setup( + x => x.ShowErrorNotification(It.IsAny()) + ); + + var mainViewModel = new MainViewModel(mockAppConfiguration.Object, mockNotificationService.Object, mockDatabaseService.Object); + mainViewModel.Activate(); + mainViewModel.SaveSettingsCommand.Execute(null); + + mockNotificationService.Verify(); + mockDatabaseService.Verify(x => x.ExpiringBills, Times.Exactly(2)); + } } } \ No newline at end of file diff --git a/MMExNotifier/Views/MainWindow.xaml b/MMExNotifier/Views/MainWindow.xaml index c71c05c..45e8242 100644 --- a/MMExNotifier/Views/MainWindow.xaml +++ b/MMExNotifier/Views/MainWindow.xaml @@ -160,6 +160,7 @@ Severity="Informational" Style="{DynamicResource IconInfoBadgeStyle}" /> +