From 87984cc6d0e7076f20b53f3bc6208406d26d7bed Mon Sep 17 00:00:00 2001 From: Stuart Ferguson Date: Thu, 1 Sep 2022 21:44:57 +0100 Subject: [PATCH] Back buttons added with Unit Tests --- .../ViewModelTests/HomePageViewModelTests.cs | 55 ++++++++++++++ .../MyAccountAddressPageViewModelTests.cs | 20 +++++ .../MyAccountContactPageViewModelTests.cs | 20 ++++- .../MyAccountDetailsPageViewModelTests.cs | 20 ++++- .../MyAccount/MyAccountPageViewModelTests.cs | 46 ++++++++++-- .../Support/SupportPageViewModelTests.cs | 31 +++++++- .../Support/ViewLogsPageViewModelTests.cs | 31 ++++++++ .../Admin/AdminPageViewModelTests.cs | 24 ++++++ .../MobileTopupFailedPageViewModelTests.cs | 2 + ...bileTopupPerformTopupPageViewModelTests.cs | 57 ++++++++++++-- ...leTopupSelectOperatorPageViewModelTests.cs | 31 +++++++- ...ileTopupSelectProductPageViewModelTests.cs | 32 +++++++- .../MobileTopupSuccessPageViewModelTests.cs | 1 + .../TransactionsPageViewModelTests.cs | 34 +++++++-- .../VoucherIssueFailedPageViewModelTests.cs | 1 + ...herIssueSelectProductPageViewModelTests.cs | 30 +++++++- .../VoucherIssueSuccessPageViewModelTests.cs | 1 + .../VoucherPerformIssuePageViewModelTests.cs | 53 +++++++++++-- ...VoucherSelectOperatorPageViewModelTests.cs | 28 ++++++- .../UIServices/INavigationService.cs | 2 + .../ViewModels/Admin/AdminPageViewModel.cs | 12 +-- .../ViewModels/ExtendedBaseViewModel.cs | 74 +++++++++++++++++++ .../ViewModels/HomePageViewModel.cs | 37 +--------- .../MyAccountAddressPageViewModel.cs | 25 ++++--- .../MyAccountContactPageViewModel.cs | 18 ++--- .../MyAccountDetailsPageViewModel.cs | 14 +--- .../MyAccount/MyAccountPageViewModel.cs | 12 +-- .../Support/SupportPageViewModel.cs | 14 ++-- .../Support/ViewLogsPageViewModel.cs | 9 ++- .../MobileTopupFailedPageViewModel.cs | 4 +- .../MobileTopupPerformTopupPageViewModel.cs | 11 +-- .../MobileTopupSelectOperatorPageViewModel.cs | 9 +-- .../MobileTopupSelectProductPageViewModel.cs | 9 +-- .../MobileTopupSuccessPageViewModel.cs | 1 + .../Transactions/TransactionsPageViewModel.cs | 10 +-- .../VoucherIssueFailedPageViewModel.cs | 1 + .../VoucherIssueSuccessPageViewModel.cs | 1 + .../VoucherPerformIssuePageViewModel.cs | 13 ++-- .../VoucherSelectOperatorPageViewModel.cs | 11 +-- .../VoucherSelectProductPageViewModel.cs | 10 +-- .../Features/Profile.feature.cs | 28 +++---- .../Pages/AppHome/HomePage.xaml | 1 + .../MyAccount/MyAccountAddressesPage.xaml | 35 +++++---- .../Pages/MyAccount/MyAccountContactPage.xaml | 33 +++++---- .../Pages/MyAccount/MyAccountDetailsPage.xaml | 43 ++++++----- .../Pages/MyAccount/MyAccountPage.xaml | 32 ++++---- .../Pages/Support/SupportPage.xaml | 41 +++++----- .../Pages/Support/ViewLogsPage.xaml | 1 + .../Pages/Transactions/Admin/AdminPage.xaml | 19 ++--- .../MobileTopup/MobileTopupFailedPage.xaml | 22 +++--- .../MobileTopupPerformTopupPage.xaml | 53 ++++++------- .../MobileTopupSelectOperatorPage.xaml | 16 ++-- .../MobileTopupSelectOperatorPage.xaml.cs | 21 +++++- .../MobileTopupSelectProductPage.xaml | 16 ++-- .../MobileTopupSelectProductPage.xaml.cs | 22 ++++++ .../MobileTopup/MobileTopupSuccessPage.xaml | 24 +++--- .../Pages/Transactions/TransactionsPage.xaml | 31 ++++---- .../Voucher/VoucherIssueFailedPage.xaml | 22 +++--- .../Voucher/VoucherIssueSuccessPage.xaml | 24 +++--- .../Voucher/VoucherPerformIssuePage.xaml | 61 +++++++-------- .../Voucher/VoucherSelectOperatorPage.xaml | 16 ++-- .../Voucher/VoucherSelectOperatorPage.xaml.cs | 22 +++++- .../Voucher/VoucherSelectProductPage.xaml | 16 ++-- .../Voucher/VoucherSelectProductPage.xaml.cs | 21 ++++++ .../Resources/Images/backbutton.svg | 45 +++++++++++ .../UIServices/ShellNavigationService.cs | 4 + 66 files changed, 1064 insertions(+), 419 deletions(-) create mode 100644 TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/HomePageViewModelTests.cs create mode 100644 TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Support/ViewLogsPageViewModelTests.cs create mode 100644 TransactionMobile.Maui.BusinessLogic/ViewModels/ExtendedBaseViewModel.cs create mode 100644 TransactionMobile.Maui/Resources/Images/backbutton.svg diff --git a/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/HomePageViewModelTests.cs b/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/HomePageViewModelTests.cs new file mode 100644 index 00000000..672c6224 --- /dev/null +++ b/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/HomePageViewModelTests.cs @@ -0,0 +1,55 @@ +namespace TransactionMobile.Maui.BusinessLogic.Tests.ViewModelTests; + +using System; +using Maui.UIServices; +using Moq; +using Services; +using Shared.Logger; +using UIServices; +using ViewModels; +using Xunit; + +public class HomePageViewModelTests +{ + [Fact] + public void HomePageViewModel_BackButtonCommand_Execute_UserSelectsToLogout_LoginPageDisplayed() + { + Mock navigationService = new Mock(); + Mock applicationCache = new Mock(); + Mock dialogService = new Mock(); + dialogService.Setup(d => d.ShowDialog(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())).ReturnsAsync(true); + HomePageViewModel viewModel = new HomePageViewModel(applicationCache.Object, + dialogService.Object, + navigationService.Object); + Logger.Initialise(NullLogger.Instance); + + viewModel.BackButtonCommand.Execute(null); + + navigationService.Verify(n => n.GoToLoginPage(), Times.Once); + dialogService.Verify(d => d.ShowDialog(It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny()), Times.Once); + } + + [Fact] + public void HomePageViewModel_BackButtonCommand_Execute_UserSelectsNotToLogout_LoginPageDisplayed() + { + Mock navigationService = new Mock(); + Mock applicationCache = new Mock(); + Mock dialogService = new Mock(); + dialogService.Setup(d => d.ShowDialog(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())).ReturnsAsync(false); + HomePageViewModel viewModel = new HomePageViewModel(applicationCache.Object, + dialogService.Object, + navigationService.Object); + Logger.Initialise(NullLogger.Instance); + + viewModel.BackButtonCommand.Execute(null); + + navigationService.VerifyNoOtherCalls(); + dialogService.Verify(d => d.ShowDialog(It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny()), Times.Once); + } +} \ No newline at end of file diff --git a/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/MyAccount/MyAccountAddressPageViewModelTests.cs b/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/MyAccount/MyAccountAddressPageViewModelTests.cs index 29d3e3a0..c1d2245e 100644 --- a/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/MyAccount/MyAccountAddressPageViewModelTests.cs +++ b/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/MyAccount/MyAccountAddressPageViewModelTests.cs @@ -8,6 +8,7 @@ using Services; using Shared.Logger; using Shouldly; +using UIServices; using ViewModels.MyAccount; using Xunit; @@ -20,10 +21,12 @@ public async Task MyAccountAddressPageViewModel_Initialise_IsInitialised() Mock navigationService = new Mock(); Mock applicationCache = new Mock(); applicationCache.Setup(a => a.GetMerchantDetails()).Returns(TestData.MerchantDetailsModel); + Mock dialogService = new Mock(); Mock mediator = new Mock(); MyAccountAddressPageViewModel viewModel = new MyAccountAddressPageViewModel(navigationService.Object, applicationCache.Object, + dialogService.Object, mediator.Object); await viewModel.Initialise(CancellationToken.None); @@ -37,4 +40,21 @@ public async Task MyAccountAddressPageViewModel_Initialise_IsInitialised() viewModel.Address.Town.ShouldBe(TestData.Town); viewModel.Address.PostalCode.ShouldBe(TestData.PostalCode); } + + [Fact] + public async Task MyAccountAddressPageViewModel_BackButtonCommand_PreviousPageIsShown() + { + Logger.Initialise(NullLogger.Instance); + Mock navigationService = new Mock(); + Mock applicationCache = new Mock(); + Mock dialogService = new Mock(); + Mock mediator = new Mock(); + MyAccountAddressPageViewModel viewModel = new MyAccountAddressPageViewModel(navigationService.Object, applicationCache.Object, + dialogService.Object, + mediator.Object); + + viewModel.BackButtonCommand.Execute(null); + + navigationService.Verify(n => n.GoBack(), Times.Once); + } } \ No newline at end of file diff --git a/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/MyAccount/MyAccountContactPageViewModelTests.cs b/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/MyAccount/MyAccountContactPageViewModelTests.cs index f3a0f774..67040c00 100644 --- a/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/MyAccount/MyAccountContactPageViewModelTests.cs +++ b/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/MyAccount/MyAccountContactPageViewModelTests.cs @@ -8,6 +8,7 @@ using Services; using Shared.Logger; using Shouldly; +using UIServices; using ViewModels.MyAccount; using Xunit; @@ -20,11 +21,11 @@ public async Task MyAccountContactPageViewModel_Initialise_IsInitialised() Mock navigationService = new Mock(); Mock applicationCache = new Mock(); applicationCache.Setup(a => a.GetMerchantDetails()).Returns(TestData.MerchantDetailsModel); - Mock mediator = new Mock(); + Mock dialogService = new Mock(); MyAccountContactPageViewModel viewModel = new MyAccountContactPageViewModel(navigationService.Object, applicationCache.Object, - mediator.Object); + dialogService.Object); await viewModel.Initialise(CancellationToken.None); applicationCache.Verify(a => a.GetMerchantDetails(), Times.Once); @@ -33,4 +34,19 @@ public async Task MyAccountContactPageViewModel_Initialise_IsInitialised() viewModel.Contact.Name.ShouldBe(TestData.ContactName); viewModel.Contact.MobileNumber.ShouldBe(TestData.ContactMobileNumber); } + + [Fact] + public async Task MyAccountContactPageViewModel_BackButtonCommand_PreviousPageIsShown() + { + Logger.Initialise(NullLogger.Instance); + Mock navigationService = new Mock(); + Mock applicationCache = new Mock(); + Mock dialogService = new Mock(); + MyAccountContactPageViewModel viewModel = new MyAccountContactPageViewModel(navigationService.Object, applicationCache.Object, + dialogService.Object); + + viewModel.BackButtonCommand.Execute(null); + + navigationService.Verify(n => n.GoBack(), Times.Once); + } } \ No newline at end of file diff --git a/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/MyAccount/MyAccountDetailsPageViewModelTests.cs b/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/MyAccount/MyAccountDetailsPageViewModelTests.cs index d35b5e29..d69eb585 100644 --- a/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/MyAccount/MyAccountDetailsPageViewModelTests.cs +++ b/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/MyAccount/MyAccountDetailsPageViewModelTests.cs @@ -8,6 +8,7 @@ using Services; using Shared.Logger; using Shouldly; +using UIServices; using ViewModels.MyAccount; using Xunit; @@ -20,11 +21,11 @@ public async Task MyAccountDetailsPageViewModel_Initialise_IsInitialised() Mock navigationService = new Mock(); Mock applicationCache = new Mock(); applicationCache.Setup(a => a.GetMerchantDetails()).Returns(TestData.MerchantDetailsModel); - Mock mediator = new Mock(); + Mock dialogService = new Mock(); MyAccountDetailsPageViewModel viewModel = new MyAccountDetailsPageViewModel(navigationService.Object, applicationCache.Object, - mediator.Object); + dialogService.Object); await viewModel.Initialise(CancellationToken.None); applicationCache.Verify(a => a.GetMerchantDetails(), Times.Once); @@ -35,4 +36,19 @@ public async Task MyAccountDetailsPageViewModel_Initialise_IsInitialised() viewModel.NextStatementDate.ShouldBe(TestData.NextStatementDate); viewModel.SettlementSchedule.ShouldBe(TestData.SettlementSchedule); } + + [Fact] + public async Task MyAccountDetailsPageViewModel_BackButtonCommand_PreviousPageIsShown() + { + Logger.Initialise(NullLogger.Instance); + Mock navigationService = new Mock(); + Mock applicationCache = new Mock(); + Mock dialogService = new Mock(); + MyAccountDetailsPageViewModel viewModel = new MyAccountDetailsPageViewModel(navigationService.Object, applicationCache.Object, + dialogService.Object); + + viewModel.BackButtonCommand.Execute(null); + + navigationService.Verify(n => n.GoBack(), Times.Once); + } } \ No newline at end of file diff --git a/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/MyAccount/MyAccountPageViewModelTests.cs b/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/MyAccount/MyAccountPageViewModelTests.cs index ac94bf26..c7d9a3fd 100644 --- a/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/MyAccount/MyAccountPageViewModelTests.cs +++ b/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/MyAccount/MyAccountPageViewModelTests.cs @@ -13,6 +13,7 @@ using Services; using Shared.Logger; using Shouldly; +using UIServices; using ViewModels.MyAccount; using Xunit; @@ -25,10 +26,14 @@ public async Task MyAccountPageViewModel_Initialise_IsInitialised() { Logger.Initialise(NullLogger.Instance); Mock navigationService = new Mock(); Mock applicationCache = new Mock(); + Mock dialogService = new Mock(); Mock mediator = new Mock(); + + MyAccountPageViewModel viewModel = new MyAccountPageViewModel(navigationService.Object, applicationCache.Object, + dialogService.Object, + mediator.Object); mediator.Setup(m => m.Send(It.IsAny(), It.IsAny())).ReturnsAsync(TestData.MerchantDetailsModel); - MyAccountPageViewModel viewModel = new MyAccountPageViewModel(navigationService.Object, applicationCache.Object, mediator.Object); await viewModel.Initialise(CancellationToken.None); viewModel.MerchantName.ShouldBe(TestData.MerchantDetailsModel.MerchantName); @@ -41,8 +46,12 @@ public void MyAccountPageViewModel_OptionSelectedCommand_AccountInfo_Execute_IsE Logger.Initialise(NullLogger.Instance); Mock navigationService = new Mock(); Mock applicationCache = new Mock(); + Mock dialogService = new Mock(); Mock mediator = new Mock(); - MyAccountPageViewModel viewModel = new MyAccountPageViewModel(navigationService.Object, applicationCache.Object, mediator.Object); + + MyAccountPageViewModel viewModel = new MyAccountPageViewModel(navigationService.Object, applicationCache.Object, + dialogService.Object, + mediator.Object); viewModel.OptionSelectedCommand.Execute(this.CreateItemSelected(MyAccountPageViewModel.AccountOptions.AccountInfo)); navigationService.Verify(n => n.GoToMyAccountDetails(), Times.Once); @@ -53,9 +62,12 @@ public void MyAccountPageViewModel_OptionSelectedCommand_Addresses_Execute_IsExe Logger.Initialise(NullLogger.Instance); Mock navigationService = new Mock(); Mock applicationCache = new Mock(); + Mock dialogService = new Mock(); Mock mediator = new Mock(); - MyAccountPageViewModel viewModel = new MyAccountPageViewModel(navigationService.Object, applicationCache.Object, mediator.Object); + MyAccountPageViewModel viewModel = new MyAccountPageViewModel(navigationService.Object, applicationCache.Object, + dialogService.Object, + mediator.Object); viewModel.OptionSelectedCommand.Execute(this.CreateItemSelected(MyAccountPageViewModel.AccountOptions.Addresses)); navigationService.Verify(n => n.GoToMyAccountAddresses(), Times.Once); @@ -66,9 +78,12 @@ public void MyAccountPageViewModel_OptionSelectedCommand_Contacts_Execute_IsExec Logger.Initialise(NullLogger.Instance); Mock navigationService = new Mock(); Mock applicationCache = new Mock(); + Mock dialogService = new Mock(); Mock mediator = new Mock(); - MyAccountPageViewModel viewModel = new MyAccountPageViewModel(navigationService.Object, applicationCache.Object, mediator.Object); + MyAccountPageViewModel viewModel = new MyAccountPageViewModel(navigationService.Object, applicationCache.Object, + dialogService.Object, + mediator.Object); viewModel.OptionSelectedCommand.Execute(this.CreateItemSelected(MyAccountPageViewModel.AccountOptions.Contacts)); navigationService.Verify(n => n.GoToMyAccountContacts(), Times.Once); @@ -79,14 +94,35 @@ public void MyAccountPageViewModel_OptionSelectedCommand_Logout_Execute_IsExecut Logger.Initialise(NullLogger.Instance); Mock navigationService = new Mock(); Mock applicationCache = new Mock(); + Mock dialogService = new Mock(); Mock mediator = new Mock(); - MyAccountPageViewModel viewModel = new MyAccountPageViewModel(navigationService.Object, applicationCache.Object, mediator.Object); + + MyAccountPageViewModel viewModel = new MyAccountPageViewModel(navigationService.Object, applicationCache.Object, + dialogService.Object, + mediator.Object); viewModel.OptionSelectedCommand.Execute(this.CreateItemSelected(MyAccountPageViewModel.AccountOptions.Logout)); navigationService.Verify(n => n.GoToLoginPage(), Times.Once); } + [Fact] + public async Task MyAccountPageViewModel_BackButtonCommand_HomePageIsShown() + { + Logger.Initialise(NullLogger.Instance); + Mock navigationService = new Mock(); + Mock applicationCache = new Mock(); + Mock dialogService = new Mock(); + Mock mediator = new Mock(); + MyAccountPageViewModel viewModel = new MyAccountPageViewModel(navigationService.Object, applicationCache.Object, + dialogService.Object, + mediator.Object); + + viewModel.BackButtonCommand.Execute(null); + + navigationService.Verify(n=> n.GoToHome(),Times.Once); + } + private ItemSelected CreateItemSelected(MyAccountPageViewModel.AccountOptions selectedOption) { ItemSelected i = new ItemSelected(); i.SelectedItemIndex = (Int32)selectedOption; diff --git a/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Support/SupportPageViewModelTests.cs b/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Support/SupportPageViewModelTests.cs index d61b281f..a508293e 100644 --- a/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Support/SupportPageViewModelTests.cs +++ b/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Support/SupportPageViewModelTests.cs @@ -11,6 +11,8 @@ namespace TransactionMobile.Maui.BusinessLogic.Tests.ViewModelTests.Support using TransactionMobile.Maui.Database; using Shared.Logger; using System.Collections.Generic; + using System.Threading; + using Requests; using Services; public class SupportPageViewModelTests @@ -24,16 +26,43 @@ public void SupportPageViewModel_UploadLogsCommand_Execute_IsExecuted() Mock deviceService = new Mock(); Mock applicationInfoService = new Mock(); Mock applicationCache = new Mock(); + Mock dialogService = new Mock(); Logger.Initialise(NullLogger.Instance); SupportPageViewModel viewModel = new SupportPageViewModel(deviceService.Object, applicationInfoService.Object, databaseContext.Object, mediator.Object, navigationService.Object, - applicationCache.Object); + applicationCache.Object, + dialogService.Object); viewModel.UploadLogsCommand.Execute(null); + mediator.Verify(m => m.Send(It.IsAny(),It.IsAny()),Times.Once); + navigationService.Verify(n => n.GoToHome(), Times.Once); + } + + [Fact] + public void SupportPageViewModel_BackButtonCommand_Execute_IsExecuted() + { + Mock navigationService = new Mock(); + Mock databaseContext = new Mock(); + Mock mediator = new Mock(); + Mock deviceService = new Mock(); + Mock applicationInfoService = new Mock(); + Mock applicationCache = new Mock(); + Mock dialogService = new Mock(); + Logger.Initialise(NullLogger.Instance); + SupportPageViewModel viewModel = new SupportPageViewModel(deviceService.Object, + applicationInfoService.Object, + databaseContext.Object, + mediator.Object, + navigationService.Object, + applicationCache.Object, + dialogService.Object); + + viewModel.BackButtonCommand.Execute(null); + navigationService.Verify(n => n.GoToHome(), Times.Once); } } diff --git a/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Support/ViewLogsPageViewModelTests.cs b/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Support/ViewLogsPageViewModelTests.cs new file mode 100644 index 00000000..e8cab9c7 --- /dev/null +++ b/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Support/ViewLogsPageViewModelTests.cs @@ -0,0 +1,31 @@ +namespace TransactionMobile.Maui.BusinessLogic.Tests.ViewModelTests.Support; + +using Maui.UIServices; +using MediatR; +using Moq; +using Services; +using Shared.Logger; +using UIServices; +using ViewModels.Support; +using Xunit; + +public class ViewLogsPageViewModelTests +{ + [Fact] + public void ViewLogsPageViewModel_BackButtonCommand_Execute_IsExecuted() + { + Mock navigationService = new Mock(); + Mock mediator = new Mock(); + Mock applicationCache = new Mock(); + Mock dialogService = new Mock(); + Logger.Initialise(NullLogger.Instance); + ViewLogsPageViewModel viewModel = new ViewLogsPageViewModel(mediator.Object, + navigationService.Object, + applicationCache.Object, + dialogService.Object); + + viewModel.BackButtonCommand.Execute(null); + + navigationService.Verify(n => n.GoBack(), Times.Once); + } +} \ No newline at end of file diff --git a/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Transactions/Admin/AdminPageViewModelTests.cs b/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Transactions/Admin/AdminPageViewModelTests.cs index 9a8b99cf..ef990843 100644 --- a/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Transactions/Admin/AdminPageViewModelTests.cs +++ b/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Transactions/Admin/AdminPageViewModelTests.cs @@ -24,13 +24,37 @@ public void AdminPageViewModel_AdminCommand_Execute_IsExecuted() Mock mediator = new Mock(); Mock deviceService = new Mock(); Mock applicationInfoService = new Mock(); + Mock dialogService = new Mock(); + Mock applicationCache = new Mock(); AdminPageViewModel viewModel = new AdminPageViewModel(mediator.Object, navigationService.Object, + applicationCache.Object, + dialogService.Object, deviceService.Object, applicationInfoService.Object); viewModel.ReconciliationCommand.Execute(null); navigationService.Verify(n => n.GoToHome(), Times.Once); } + + [Fact] + public void AdminPageViewModel_BackButtonCommand_Execute_IsExecuted() + { + Mock navigationService = new Mock(); + Mock mediator = new Mock(); + Mock deviceService = new Mock(); + Mock applicationInfoService = new Mock(); + Mock dialogService = new Mock(); + Mock applicationCache = new Mock(); + AdminPageViewModel viewModel = new AdminPageViewModel(mediator.Object, + navigationService.Object, + applicationCache.Object, + dialogService.Object, + deviceService.Object, + applicationInfoService.Object); + + viewModel.BackButtonCommand.Execute(null); + navigationService.Verify(n => n.GoBack(), Times.Once); + } } } diff --git a/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Transactions/MobileTopup/MobileTopupFailedPageViewModelTests.cs b/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Transactions/MobileTopup/MobileTopupFailedPageViewModelTests.cs index fe311e1c..737db4d5 100644 --- a/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Transactions/MobileTopup/MobileTopupFailedPageViewModelTests.cs +++ b/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Transactions/MobileTopup/MobileTopupFailedPageViewModelTests.cs @@ -2,6 +2,7 @@ namespace TransactionMobile.Maui.BusinessLogic.Tests.ViewModelTests.Transactions using Maui.UIServices; using Moq; +using Services; using Shared.Logger; using UIServices; using ViewModels.Transactions; @@ -13,6 +14,7 @@ public class MobileTopupFailedPageViewModelTests public void MobileTopupFailedPageViewModel_CancelledCommand_Execute_IsExecuted() { Mock navigationService = new Mock(); + Logger.Initialise(NullLogger.Instance); MobileTopupFailedPageViewModel viewModel = new MobileTopupFailedPageViewModel(navigationService.Object); diff --git a/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Transactions/MobileTopup/MobileTopupPerformTopupPageViewModelTests.cs b/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Transactions/MobileTopup/MobileTopupPerformTopupPageViewModelTests.cs index 5bf5bcc2..840a8f5c 100644 --- a/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Transactions/MobileTopup/MobileTopupPerformTopupPageViewModelTests.cs +++ b/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Transactions/MobileTopup/MobileTopupPerformTopupPageViewModelTests.cs @@ -7,6 +7,7 @@ namespace TransactionMobile.Maui.BusinessLogic.Tests.ViewModelTests.Transactions using MediatR; using Moq; using Requests; +using Services; using Shared.Logger; using Shouldly; using UIServices; @@ -20,8 +21,13 @@ public void MobileTopupPerformTopupPageViewModel_ApplyQueryAttributes_QueryAttri { Mock mediator = new Mock(); Mock navigationService = new Mock(); + Mock applicationCache = new Mock(); + Mock dialogSevice = new Mock(); Logger.Initialise(NullLogger.Instance); - MobileTopupPerformTopupPageViewModel viewModel = new MobileTopupPerformTopupPageViewModel(mediator.Object, navigationService.Object); + MobileTopupPerformTopupPageViewModel viewModel = new MobileTopupPerformTopupPageViewModel(mediator.Object, + navigationService.Object, + applicationCache.Object, + dialogSevice.Object); viewModel.ApplyQueryAttributes(new Dictionary { @@ -42,8 +48,11 @@ public void MobileTopupPerformTopupPageViewModel_CustomerEmailAddressEntryComple { Mock mediator = new Mock(); Mock navigationService = new Mock(); + Mock applicationCache = new Mock(); + Mock dialogSevice = new Mock(); Logger.Initialise(NullLogger.Instance); - MobileTopupPerformTopupPageViewModel viewModel = new MobileTopupPerformTopupPageViewModel(mediator.Object, navigationService.Object); + MobileTopupPerformTopupPageViewModel viewModel = new MobileTopupPerformTopupPageViewModel(mediator.Object, navigationService.Object, + applicationCache.Object,dialogSevice.Object); bool isCompletedCalled = false; viewModel.OnCustomerEmailAddressEntryCompleted = () => { @@ -66,9 +75,12 @@ public void MobileTopupPerformTopupPageViewModel_CustomerMobileNumberEntryComple { Mock mediator = new Mock(); Mock navigationService = new Mock(); + Mock applicationCache = new Mock(); + Mock dialogSevice = new Mock(); Logger.Initialise(NullLogger.Instance); - MobileTopupPerformTopupPageViewModel viewModel = new MobileTopupPerformTopupPageViewModel(mediator.Object, navigationService.Object); - bool isCompletedCalled = false; + MobileTopupPerformTopupPageViewModel viewModel = new MobileTopupPerformTopupPageViewModel(mediator.Object, navigationService.Object,applicationCache.Object, + dialogSevice.Object); + Boolean isCompletedCalled = false; viewModel.OnCustomerMobileNumberEntryCompleted = () => { isCompletedCalled = true; @@ -90,9 +102,13 @@ public void MobileTopupPerformTopupPageViewModel_TopupAmountEntryCompletedComman { Mock mediator = new Mock(); Mock navigationService = new Mock(); + Mock applicationCache = new Mock(); + Mock dialogSevice = new Mock(); Logger.Initialise(NullLogger.Instance); - MobileTopupPerformTopupPageViewModel viewModel = new MobileTopupPerformTopupPageViewModel(mediator.Object, navigationService.Object); - bool isCompletedCalled = false; + MobileTopupPerformTopupPageViewModel viewModel = new MobileTopupPerformTopupPageViewModel(mediator.Object, navigationService.Object, + applicationCache.Object, + dialogSevice.Object); + Boolean isCompletedCalled = false; viewModel.OnTopupAmountEntryCompleted = () => { isCompletedCalled = true; @@ -115,8 +131,12 @@ public void MobileTopupPerformTopupPageViewModel_PerformTopupCommand_Execute_Suc Mock mediator = new Mock(); mediator.Setup(m => m.Send(It.IsAny(), It.IsAny())).ReturnsAsync(true); Mock navigationService = new Mock(); + Mock applicationCache = new Mock(); + Mock dialogSevice = new Mock(); Logger.Initialise(NullLogger.Instance); - MobileTopupPerformTopupPageViewModel viewModel = new MobileTopupPerformTopupPageViewModel(mediator.Object, navigationService.Object); + MobileTopupPerformTopupPageViewModel viewModel = new MobileTopupPerformTopupPageViewModel(mediator.Object, navigationService.Object, + applicationCache.Object, + dialogSevice.Object); viewModel.ApplyQueryAttributes(new Dictionary { {nameof(viewModel.ContractId), TestData.OperatorId1ContractId}, @@ -135,8 +155,12 @@ public void MobileTopupPerformTopupPageViewModel_PerformTopupCommand_Execute_Fai Mock mediator = new Mock(); mediator.Setup(m => m.Send(It.IsAny(), It.IsAny())).ReturnsAsync(false); Mock navigationService = new Mock(); + Mock applicationCache = new Mock(); + Mock dialogSevice = new Mock(); Logger.Initialise(NullLogger.Instance); - MobileTopupPerformTopupPageViewModel viewModel = new MobileTopupPerformTopupPageViewModel(mediator.Object, navigationService.Object); + MobileTopupPerformTopupPageViewModel viewModel = new MobileTopupPerformTopupPageViewModel(mediator.Object, navigationService.Object, + applicationCache.Object, + dialogSevice.Object); viewModel.ApplyQueryAttributes(new Dictionary { {nameof(viewModel.ContractId), TestData.OperatorId1ContractId}, @@ -148,4 +172,21 @@ public void MobileTopupPerformTopupPageViewModel_PerformTopupCommand_Execute_Fai mediator.Verify(m => m.Send(It.IsAny(), It.IsAny()), Times.Once); navigationService.Verify(v => v.GoToMobileTopupFailedPage(), Times.Once); } + + [Fact] + public void MobileTopupPerformTopupPageViewModel_BackButtonCommand_Execute_IsExecuted() + { + Mock mediator = new Mock(); + mediator.Setup(m => m.Send(It.IsAny(), It.IsAny())).ReturnsAsync(false); + Mock navigationService = new Mock(); + Mock applicationCache = new Mock(); + Mock dialogSevice = new Mock(); + Logger.Initialise(NullLogger.Instance); + MobileTopupPerformTopupPageViewModel viewModel = new MobileTopupPerformTopupPageViewModel(mediator.Object, navigationService.Object, + applicationCache.Object, + dialogSevice.Object); + + viewModel.BackButtonCommand.Execute(null); + navigationService.Verify(v => v.GoBack(), Times.Once); + } } \ No newline at end of file diff --git a/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Transactions/MobileTopup/MobileTopupSelectOperatorPageViewModelTests.cs b/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Transactions/MobileTopup/MobileTopupSelectOperatorPageViewModelTests.cs index b27fa68d..5812ef1f 100644 --- a/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Transactions/MobileTopup/MobileTopupSelectOperatorPageViewModelTests.cs +++ b/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Transactions/MobileTopup/MobileTopupSelectOperatorPageViewModelTests.cs @@ -8,6 +8,7 @@ namespace TransactionMobile.Maui.BusinessLogic.Tests.ViewModelTests.Transactions using Models; using Moq; using Requests; +using Services; using Shared.Logger; using Shouldly; using UIServices; @@ -22,7 +23,9 @@ public async Task MobileTopupSelectOperatorPageViewModel_Initialise_IsInitialise Mock mediator = new Mock(); mediator.Setup(m => m.Send(It.IsAny(), It.IsAny())).ReturnsAsync(TestData.ContractProductList); Mock navigationService = new Mock(); - MobileTopupSelectOperatorPageViewModel viewModel = new MobileTopupSelectOperatorPageViewModel(mediator.Object, navigationService.Object); + Mock applicationCache = new Mock(); + Mock dialogSevice = new Mock(); + MobileTopupSelectOperatorPageViewModel viewModel = new MobileTopupSelectOperatorPageViewModel(mediator.Object, navigationService.Object,dialogSevice.Object,applicationCache.Object); await viewModel.Initialise(CancellationToken.None); mediator.Verify(x => x.Send(It.IsAny(), It.IsAny()), Times.Once); @@ -36,8 +39,10 @@ public async Task MobileTopupSelectOperatorPageViewModel_OperatorSelectedCommand Mock mediator = new Mock(); mediator.Setup(m => m.Send(It.IsAny(), It.IsAny())).ReturnsAsync(TestData.ContractProductList); Mock navigationService = new Mock(); + Mock applicationCache = new Mock(); + Mock dialogSevice = new Mock(); Logger.Initialise(NullLogger.Instance); - MobileTopupSelectOperatorPageViewModel viewModel = new MobileTopupSelectOperatorPageViewModel(mediator.Object, navigationService.Object); + MobileTopupSelectOperatorPageViewModel viewModel = new MobileTopupSelectOperatorPageViewModel(mediator.Object, navigationService.Object,dialogSevice.Object,applicationCache.Object); await viewModel.Initialise(CancellationToken.None); @@ -53,4 +58,26 @@ public async Task MobileTopupSelectOperatorPageViewModel_OperatorSelectedCommand navigationService.Verify(n => n.GoToMobileTopupSelectProductPage(TestData.OperatorIdentifier1), Times.Once); } + + [Fact] + public async Task MobileTopupSelectOperatorPageViewModel_BackButtonCommand_Execute_IsExecuted() + { + Mock mediator = new Mock(); + mediator.Setup(m => m.Send(It.IsAny(), It.IsAny())).ReturnsAsync(TestData.ContractProductList); + Mock navigationService = new Mock(); + Mock applicationCache = new Mock(); + Mock dialogSevice = new Mock(); + Logger.Initialise(NullLogger.Instance); + MobileTopupSelectOperatorPageViewModel viewModel = new MobileTopupSelectOperatorPageViewModel(mediator.Object, navigationService.Object, dialogSevice.Object, applicationCache.Object); + + ItemSelected selectedContractOperator = new ItemSelected + { + SelectedItemIndex = 1, + SelectedItem = TestData.ContractOperatorModel + }; + + viewModel.BackButtonCommand.Execute(null); + + navigationService.Verify(n => n.GoBack(), Times.Once); + } } \ No newline at end of file diff --git a/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Transactions/MobileTopup/MobileTopupSelectProductPageViewModelTests.cs b/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Transactions/MobileTopup/MobileTopupSelectProductPageViewModelTests.cs index 2d1fc48e..5c9ddd5b 100644 --- a/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Transactions/MobileTopup/MobileTopupSelectProductPageViewModelTests.cs +++ b/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Transactions/MobileTopup/MobileTopupSelectProductPageViewModelTests.cs @@ -10,8 +10,10 @@ namespace TransactionMobile.Maui.BusinessLogic.Tests.ViewModelTests.Transactions using Models; using Moq; using Requests; +using Services; using Shared.Logger; using Shouldly; +using UIServices; using ViewModels.Transactions; using Xunit; @@ -24,7 +26,11 @@ public async Task MobileTopupSelectProductPageViewModel_ApplyQueryAttributes_Que Mock mediator = new Mock(); mediator.Setup(m => m.Send(It.IsAny(), It.IsAny())).ReturnsAsync(TestData.ContractProductList); Mock navigationService = new Mock(); - MobileTopupSelectProductPageViewModel viewModel = new MobileTopupSelectProductPageViewModel(mediator.Object, navigationService.Object); + Mock applicationCache = new Mock(); + Mock dialogSevice = new Mock(); + MobileTopupSelectProductPageViewModel viewModel = new MobileTopupSelectProductPageViewModel(mediator.Object, navigationService.Object, + applicationCache.Object, + dialogSevice.Object); viewModel.ApplyQueryAttributes(new Dictionary { {nameof(viewModel.OperatorIdentifier), TestData.OperatorIdentifier1} @@ -37,7 +43,9 @@ public async Task MobileTopupSelectProductPageViewModel_Initialise_IsInitialised Mock mediator = new Mock(); mediator.Setup(m => m.Send(It.IsAny(), It.IsAny())).ReturnsAsync(TestData.ContractProductList); Mock navigationService = new Mock(); - MobileTopupSelectProductPageViewModel viewModel = new MobileTopupSelectProductPageViewModel(mediator.Object, navigationService.Object); + Mock applicationCache = new Mock(); + Mock dialogSevice = new Mock(); + MobileTopupSelectProductPageViewModel viewModel = new MobileTopupSelectProductPageViewModel(mediator.Object, navigationService.Object, applicationCache.Object, dialogSevice.Object); viewModel.ApplyQueryAttributes(new Dictionary { {nameof(viewModel.OperatorIdentifier), TestData.OperatorIdentifier1} @@ -53,8 +61,10 @@ public async Task MobileTopupSelectProductPageViewModel_ProductSelectedCommand_E Mock mediator = new Mock(); mediator.Setup(m => m.Send(It.IsAny(), It.IsAny())).ReturnsAsync(TestData.ContractProductList); Mock navigationService = new Mock(); + Mock applicationCache = new Mock(); + Mock dialogSevice = new Mock(); Logger.Initialise(NullLogger.Instance); - MobileTopupSelectProductPageViewModel viewModel = new MobileTopupSelectProductPageViewModel(mediator.Object, navigationService.Object); + MobileTopupSelectProductPageViewModel viewModel = new MobileTopupSelectProductPageViewModel(mediator.Object, navigationService.Object, applicationCache.Object, dialogSevice.Object); viewModel.ApplyQueryAttributes(new Dictionary { {nameof(viewModel.OperatorIdentifier), TestData.OperatorIdentifier1} @@ -74,5 +84,21 @@ public async Task MobileTopupSelectProductPageViewModel_ProductSelectedCommand_E navigationService.Verify(n => n.GoToMobileTopupPerformTopupPage(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny()), Times.Once); } + [Fact] + public async Task MobileTopupSelectProductPageViewModel_BackButtonCommand_Execute_IsExecuted() + { + Mock mediator = new Mock(); + mediator.Setup(m => m.Send(It.IsAny(), It.IsAny())).ReturnsAsync(TestData.ContractProductList); + Mock navigationService = new Mock(); + Mock applicationCache = new Mock(); + Mock dialogSevice = new Mock(); + Logger.Initialise(NullLogger.Instance); + MobileTopupSelectProductPageViewModel viewModel = new MobileTopupSelectProductPageViewModel(mediator.Object, navigationService.Object, applicationCache.Object, dialogSevice.Object); + + viewModel.BackButtonCommand.Execute(null); + + navigationService.Verify(n => n.GoBack(), Times.Once); + } + #endregion } \ No newline at end of file diff --git a/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Transactions/MobileTopup/MobileTopupSuccessPageViewModelTests.cs b/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Transactions/MobileTopup/MobileTopupSuccessPageViewModelTests.cs index 718ef342..04f75941 100644 --- a/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Transactions/MobileTopup/MobileTopupSuccessPageViewModelTests.cs +++ b/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Transactions/MobileTopup/MobileTopupSuccessPageViewModelTests.cs @@ -2,6 +2,7 @@ namespace TransactionMobile.Maui.BusinessLogic.Tests.ViewModelTests.Transactions using Maui.UIServices; using Moq; +using Services; using Shared.Logger; using UIServices; using ViewModels.Transactions; diff --git a/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Transactions/TransactionsPageViewModelTests.cs b/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Transactions/TransactionsPageViewModelTests.cs index bcff196f..2710ae37 100644 --- a/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Transactions/TransactionsPageViewModelTests.cs +++ b/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Transactions/TransactionsPageViewModelTests.cs @@ -2,6 +2,7 @@ namespace TransactionMobile.Maui.BusinessLogic.Tests.ViewModelTests.Transactions using Maui.UIServices; using Moq; +using Services; using Shared.Logger; using UIServices; using ViewModels.Transactions; @@ -13,7 +14,9 @@ public class TransactionsPageViewModelTests public void TransactionsPageViewModel_AdminCommand_Execute_IsExecuted() { Mock navigationService = new Mock(); - TransactionsPageViewModel viewModel = new TransactionsPageViewModel(navigationService.Object); + Mock applicationCache = new Mock(); + Mock dialogSevice = new Mock(); + TransactionsPageViewModel viewModel = new TransactionsPageViewModel(navigationService.Object,applicationCache.Object,dialogSevice.Object); viewModel.AdminCommand.Execute(null); navigationService.Verify(n => n.GoToAdminPage(), Times.Once); @@ -23,8 +26,10 @@ public void TransactionsPageViewModel_AdminCommand_Execute_IsExecuted() public void TransactionsPageViewModel_BillPaymentCommand_Execute_IsExecuted() { Mock navigationService = new Mock(); + Mock applicationCache = new Mock(); + Mock dialogSevice = new Mock(); Logger.Initialise(NullLogger.Instance); - TransactionsPageViewModel viewModel = new TransactionsPageViewModel(navigationService.Object); + TransactionsPageViewModel viewModel = new TransactionsPageViewModel(navigationService.Object, applicationCache.Object, dialogSevice.Object); viewModel.BillPaymentCommand.Execute(null); navigationService.Verify(n => n.GoToHome(), Times.Once); @@ -34,8 +39,10 @@ public void TransactionsPageViewModel_BillPaymentCommand_Execute_IsExecuted() public void TransactionsPageViewModel_MobileTopupCommand_Execute_IsExecuted() { Mock navigationService = new Mock(); + Mock applicationCache = new Mock(); + Mock dialogSevice = new Mock(); Logger.Initialise(NullLogger.Instance); - TransactionsPageViewModel viewModel = new TransactionsPageViewModel(navigationService.Object); + TransactionsPageViewModel viewModel = new TransactionsPageViewModel(navigationService.Object, applicationCache.Object, dialogSevice.Object); viewModel.MobileTopupCommand.Execute(null); navigationService.Verify(n => n.GoToMobileTopupSelectOperatorPage(), Times.Once); @@ -45,8 +52,10 @@ public void TransactionsPageViewModel_MobileTopupCommand_Execute_IsExecuted() public void TransactionsPageViewModel_MobileWalletCommand_Execute_IsExecuted() { Mock navigationService = new Mock(); + Mock applicationCache = new Mock(); + Mock dialogSevice = new Mock(); Logger.Initialise(NullLogger.Instance); - TransactionsPageViewModel viewModel = new TransactionsPageViewModel(navigationService.Object); + TransactionsPageViewModel viewModel = new TransactionsPageViewModel(navigationService.Object, applicationCache.Object, dialogSevice.Object); viewModel.MobileWalletCommand.Execute(null); navigationService.Verify(n => n.GoToHome(), Times.Once); @@ -56,10 +65,25 @@ public void TransactionsPageViewModel_MobileWalletCommand_Execute_IsExecuted() public void TransactionsPageViewModel_VoucherCommand_Execute_IsExecuted() { Mock navigationService = new Mock(); + Mock applicationCache = new Mock(); + Mock dialogSevice = new Mock(); Logger.Initialise(NullLogger.Instance); - TransactionsPageViewModel viewModel = new TransactionsPageViewModel(navigationService.Object); + TransactionsPageViewModel viewModel = new TransactionsPageViewModel(navigationService.Object, applicationCache.Object, dialogSevice.Object); viewModel.VoucherCommand.Execute(null); navigationService.Verify(n => n.GoToVoucherSelectOperatorPage(), Times.Once); } + + [Fact] + public void TransactionsPageViewModel_BackButtonCommand_Execute_IsExecuted() + { + Mock navigationService = new Mock(); + Mock applicationCache = new Mock(); + Mock dialogSevice = new Mock(); + Logger.Initialise(NullLogger.Instance); + TransactionsPageViewModel viewModel = new TransactionsPageViewModel(navigationService.Object, applicationCache.Object, dialogSevice.Object); + + viewModel.BackButtonCommand.Execute(null); + navigationService.Verify(n => n.GoToHome(), Times.Once); + } } \ No newline at end of file diff --git a/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Transactions/Voucher/VoucherIssueFailedPageViewModelTests.cs b/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Transactions/Voucher/VoucherIssueFailedPageViewModelTests.cs index 46d252fb..60707fb9 100644 --- a/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Transactions/Voucher/VoucherIssueFailedPageViewModelTests.cs +++ b/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Transactions/Voucher/VoucherIssueFailedPageViewModelTests.cs @@ -2,6 +2,7 @@ namespace TransactionMobile.Maui.BusinessLogic.Tests.ViewModelTests.Transactions using Maui.UIServices; using Moq; +using Services; using Shared.Logger; using UIServices; using ViewModels.Transactions; diff --git a/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Transactions/Voucher/VoucherIssueSelectProductPageViewModelTests.cs b/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Transactions/Voucher/VoucherIssueSelectProductPageViewModelTests.cs index 7d66fb57..1e052052 100644 --- a/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Transactions/Voucher/VoucherIssueSelectProductPageViewModelTests.cs +++ b/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Transactions/Voucher/VoucherIssueSelectProductPageViewModelTests.cs @@ -10,8 +10,10 @@ namespace TransactionMobile.Maui.BusinessLogic.Tests.ViewModelTests.Transactions using Models; using Moq; using Requests; +using Services; using Shared.Logger; using Shouldly; +using UIServices; using ViewModels.Transactions; using Xunit; @@ -24,7 +26,9 @@ public async Task VoucherIssueSelectProductPageViewModel_ApplyQueryAttributes_Qu Mock mediator = new Mock(); mediator.Setup(m => m.Send(It.IsAny(), It.IsAny())).ReturnsAsync(TestData.ContractProductList); Mock navigationService = new Mock(); - VoucherSelectProductPageViewModel viewModel = new VoucherSelectProductPageViewModel(mediator.Object, navigationService.Object); + Mock applicationCache = new Mock(); + Mock dialogSevice = new Mock(); + VoucherSelectProductPageViewModel viewModel = new VoucherSelectProductPageViewModel(mediator.Object, navigationService.Object,applicationCache.Object, dialogSevice.Object); viewModel.ApplyQueryAttributes(new Dictionary { {nameof(viewModel.OperatorIdentifier), TestData.OperatorIdentifier1} @@ -37,7 +41,9 @@ public async Task VoucherIssueSelectProductPageViewModel_Initialise_IsInitialise Mock mediator = new Mock(); mediator.Setup(m => m.Send(It.IsAny(), It.IsAny())).ReturnsAsync(TestData.ContractProductList); Mock navigationService = new Mock(); - VoucherSelectProductPageViewModel viewModel = new VoucherSelectProductPageViewModel(mediator.Object, navigationService.Object); + Mock applicationCache = new Mock(); + Mock dialogSevice = new Mock(); + VoucherSelectProductPageViewModel viewModel = new VoucherSelectProductPageViewModel(mediator.Object, navigationService.Object, applicationCache.Object, dialogSevice.Object); viewModel.ApplyQueryAttributes(new Dictionary { {nameof(viewModel.OperatorIdentifier), TestData.OperatorIdentifier1} @@ -53,8 +59,10 @@ public async Task VoucherIssueSelectProductPageViewModel_ProductSelectedCommand_ Mock mediator = new Mock(); mediator.Setup(m => m.Send(It.IsAny(), It.IsAny())).ReturnsAsync(TestData.ContractProductList); Mock navigationService = new Mock(); + Mock applicationCache = new Mock(); + Mock dialogSevice = new Mock(); Logger.Initialise(NullLogger.Instance); - VoucherSelectProductPageViewModel viewModel = new VoucherSelectProductPageViewModel(mediator.Object, navigationService.Object); + VoucherSelectProductPageViewModel viewModel = new VoucherSelectProductPageViewModel(mediator.Object, navigationService.Object, applicationCache.Object, dialogSevice.Object); viewModel.ApplyQueryAttributes(new Dictionary { {nameof(viewModel.OperatorIdentifier), TestData.OperatorIdentifier1} @@ -74,5 +82,21 @@ public async Task VoucherIssueSelectProductPageViewModel_ProductSelectedCommand_ navigationService.Verify(n => n.GoToVoucherIssueVoucherPage(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny()), Times.Once); } + [Fact] + public async Task VoucherIssueSelectProductPageViewModel_BackButtonCommand_Execute_IsExecuted() + { + Mock mediator = new Mock(); + mediator.Setup(m => m.Send(It.IsAny(), It.IsAny())).ReturnsAsync(TestData.ContractProductList); + Mock navigationService = new Mock(); + Mock applicationCache = new Mock(); + Mock dialogSevice = new Mock(); + Logger.Initialise(NullLogger.Instance); + VoucherSelectProductPageViewModel viewModel = new VoucherSelectProductPageViewModel(mediator.Object, navigationService.Object, applicationCache.Object, dialogSevice.Object); + + viewModel.BackButtonCommand.Execute(null); + + navigationService.Verify(n => n.GoBack(), Times.Once); + } + #endregion } \ No newline at end of file diff --git a/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Transactions/Voucher/VoucherIssueSuccessPageViewModelTests.cs b/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Transactions/Voucher/VoucherIssueSuccessPageViewModelTests.cs index 7337b99c..f161d4f7 100644 --- a/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Transactions/Voucher/VoucherIssueSuccessPageViewModelTests.cs +++ b/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Transactions/Voucher/VoucherIssueSuccessPageViewModelTests.cs @@ -2,6 +2,7 @@ namespace TransactionMobile.Maui.BusinessLogic.Tests.ViewModelTests.Transactions using Maui.UIServices; using Moq; +using Services; using Shared.Logger; using UIServices; using ViewModels.Transactions; diff --git a/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Transactions/Voucher/VoucherPerformIssuePageViewModelTests.cs b/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Transactions/Voucher/VoucherPerformIssuePageViewModelTests.cs index 3390bdbd..315cfba6 100644 --- a/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Transactions/Voucher/VoucherPerformIssuePageViewModelTests.cs +++ b/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Transactions/Voucher/VoucherPerformIssuePageViewModelTests.cs @@ -7,6 +7,7 @@ namespace TransactionMobile.Maui.BusinessLogic.Tests.ViewModelTests.Transactions using MediatR; using Moq; using Requests; +using Services; using Shared.Logger; using Shouldly; using UIServices; @@ -20,7 +21,9 @@ public void VoucherPerformIssuePageViewModel_ApplyQueryAttributes_QueryAttribute { Mock mediator = new Mock(); Mock navigationService = new Mock(); - VoucherPerformIssuePageViewModel viewModel = new VoucherPerformIssuePageViewModel(mediator.Object, navigationService.Object); + Mock applicationCache = new Mock(); + Mock dialogService = new Mock(); + VoucherPerformIssuePageViewModel viewModel = new VoucherPerformIssuePageViewModel(navigationService.Object, applicationCache.Object,dialogService.Object, mediator.Object); viewModel.ApplyQueryAttributes(new Dictionary { @@ -41,8 +44,11 @@ public void VoucherPerformIssuePageViewModel_CustomerEmailAddressEntryCompletedC { Mock mediator = new Mock(); Mock navigationService = new Mock(); + Mock applicationCache = new Mock(); + Mock dialogService = new Mock(); Logger.Initialise(NullLogger.Instance); - VoucherPerformIssuePageViewModel viewModel = new VoucherPerformIssuePageViewModel(mediator.Object, navigationService.Object); + VoucherPerformIssuePageViewModel viewModel = new VoucherPerformIssuePageViewModel(navigationService.Object,applicationCache.Object, dialogService.Object, + mediator.Object); bool isCompletedCalled = false; viewModel.OnCustomerEmailAddressEntryCompleted = () => { @@ -65,8 +71,12 @@ public void VoucherPerformIssuePageViewModel_RecipientMobileNumberEntryCompleted { Mock mediator = new Mock(); Mock navigationService = new Mock(); + Mock applicationCache = new Mock(); + Mock dialogService = new Mock(); Logger.Initialise(NullLogger.Instance); - VoucherPerformIssuePageViewModel viewModel = new VoucherPerformIssuePageViewModel(mediator.Object, navigationService.Object); + VoucherPerformIssuePageViewModel viewModel = new VoucherPerformIssuePageViewModel(navigationService.Object, applicationCache.Object, + dialogService.Object, + mediator.Object); bool isCompletedCalled = false; viewModel.OnRecipientMobileNumberEntryCompleted = () => { @@ -89,8 +99,11 @@ public void VoucherPerformIssuePageViewModel_RecipientEmailAddressEntryCompleted { Mock mediator = new Mock(); Mock navigationService = new Mock(); + Mock applicationCache = new Mock(); + Mock dialogService = new Mock(); Logger.Initialise(NullLogger.Instance); - VoucherPerformIssuePageViewModel viewModel = new VoucherPerformIssuePageViewModel(mediator.Object, navigationService.Object); + VoucherPerformIssuePageViewModel viewModel = new VoucherPerformIssuePageViewModel(navigationService.Object, applicationCache.Object, + dialogService.Object,mediator.Object); bool isCompletedCalled = false; viewModel.OnRecipientEmailAddressEntryCompleted = () => { @@ -113,8 +126,11 @@ public void VoucherPerformIssuePageViewModel_VoucherAmountEntryCompletedCommand_ { Mock mediator = new Mock(); Mock navigationService = new Mock(); + Mock applicationCache = new Mock(); + Mock dialogService = new Mock(); Logger.Initialise(NullLogger.Instance); - VoucherPerformIssuePageViewModel viewModel = new VoucherPerformIssuePageViewModel(mediator.Object, navigationService.Object); + VoucherPerformIssuePageViewModel viewModel = new VoucherPerformIssuePageViewModel(navigationService.Object, applicationCache.Object, + dialogService.Object, mediator.Object); bool isCompletedCalled = false; viewModel.OnVoucherAmountEntryCompleted = () => { @@ -138,8 +154,11 @@ public void VoucherPerformIssuePageViewModel_IssueVoucherCommand_Execute_Success Mock mediator = new Mock(); mediator.Setup(m => m.Send(It.IsAny(), It.IsAny())).ReturnsAsync(true); Mock navigationService = new Mock(); + Mock applicationCache = new Mock(); + Mock dialogService = new Mock(); Logger.Initialise(NullLogger.Instance); - VoucherPerformIssuePageViewModel viewModel = new VoucherPerformIssuePageViewModel(mediator.Object, navigationService.Object); + VoucherPerformIssuePageViewModel viewModel = new VoucherPerformIssuePageViewModel(navigationService.Object, applicationCache.Object, + dialogService.Object, mediator.Object); viewModel.ApplyQueryAttributes(new Dictionary { {nameof(viewModel.ContractId), TestData.OperatorId1ContractId}, @@ -158,9 +177,11 @@ public void VoucherPerformIssuePageViewModel_IssueVoucherCommand_Execute_FailedV Mock mediator = new Mock(); mediator.Setup(m => m.Send(It.IsAny(), It.IsAny())).ReturnsAsync(false); Mock navigationService = new Mock(); + Mock applicationCache = new Mock(); + Mock dialogService = new Mock(); Logger.Initialise(NullLogger.Instance); - - VoucherPerformIssuePageViewModel viewModel = new VoucherPerformIssuePageViewModel(mediator.Object, navigationService.Object); + VoucherPerformIssuePageViewModel viewModel = new VoucherPerformIssuePageViewModel(navigationService.Object, applicationCache.Object, + dialogService.Object, mediator.Object); viewModel.ApplyQueryAttributes(new Dictionary { {nameof(viewModel.ContractId), TestData.OperatorId1ContractId}, @@ -172,4 +193,20 @@ public void VoucherPerformIssuePageViewModel_IssueVoucherCommand_Execute_FailedV mediator.Verify(m => m.Send(It.IsAny(), It.IsAny()), Times.Once); navigationService.Verify(v => v.GoToVoucherIssueFailedPage(), Times.Once); } + + [Fact] + public void VoucherPerformIssuePageViewModel_BackButtonCommand_Execute_IsExecuted() + { + Mock mediator = new Mock(); + mediator.Setup(m => m.Send(It.IsAny(), It.IsAny())).ReturnsAsync(true); + Mock navigationService = new Mock(); + Mock applicationCache = new Mock(); + Mock dialogService = new Mock(); + Logger.Initialise(NullLogger.Instance); + VoucherPerformIssuePageViewModel viewModel = new VoucherPerformIssuePageViewModel(navigationService.Object, applicationCache.Object, + dialogService.Object, mediator.Object); + viewModel.BackButtonCommand.Execute(null); + + navigationService.Verify(v => v.GoBack(), Times.Once); + } } \ No newline at end of file diff --git a/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Transactions/Voucher/VoucherSelectOperatorPageViewModelTests.cs b/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Transactions/Voucher/VoucherSelectOperatorPageViewModelTests.cs index 7050c5ff..61fbfbb0 100644 --- a/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Transactions/Voucher/VoucherSelectOperatorPageViewModelTests.cs +++ b/TransactionMobile.Maui.BusinessLogic.Tests/ViewModelTests/Transactions/Voucher/VoucherSelectOperatorPageViewModelTests.cs @@ -8,6 +8,7 @@ namespace TransactionMobile.Maui.BusinessLogic.Tests.ViewModelTests.Transactions using Models; using Moq; using Requests; +using Services; using Shared.Logger; using Shouldly; using UIServices; @@ -22,7 +23,10 @@ public async Task VoucherSelectOperatorPageViewModel_Initialise_IsInitialised() Mock mediator = new Mock(); mediator.Setup(m => m.Send(It.IsAny(), It.IsAny())).ReturnsAsync(TestData.ContractProductList); Mock navigationService = new Mock(); - VoucherSelectOperatorPageViewModel viewModel = new VoucherSelectOperatorPageViewModel(mediator.Object, navigationService.Object); + Mock applicationCache = new Mock(); + Mock dialogSevice = new Mock(); + VoucherSelectOperatorPageViewModel viewModel = new VoucherSelectOperatorPageViewModel(mediator.Object, navigationService.Object,applicationCache.Object, + dialogSevice.Object); await viewModel.Initialise(CancellationToken.None); mediator.Verify(x => x.Send(It.IsAny(), It.IsAny()), Times.Once); @@ -36,8 +40,11 @@ public async Task VoucherSelectOperatorPageViewModel_OperatorSelectedCommand_Exe Mock mediator = new Mock(); mediator.Setup(m => m.Send(It.IsAny(), It.IsAny())).ReturnsAsync(TestData.ContractProductList); Mock navigationService = new Mock(); + Mock applicationCache = new Mock(); + Mock dialogSevice = new Mock(); Logger.Initialise(NullLogger.Instance); - VoucherSelectOperatorPageViewModel viewModel = new VoucherSelectOperatorPageViewModel(mediator.Object, navigationService.Object); + VoucherSelectOperatorPageViewModel viewModel = new VoucherSelectOperatorPageViewModel(mediator.Object, navigationService.Object,applicationCache.Object, + dialogSevice.Object); await viewModel.Initialise(CancellationToken.None); @@ -53,4 +60,21 @@ public async Task VoucherSelectOperatorPageViewModel_OperatorSelectedCommand_Exe navigationService.Verify(n => n.GoToVoucherSelectProductPage(TestData.OperatorIdentifier1), Times.Once); } + + [Fact] + public void VoucherSelectOperatorPageViewModel_BackButtonCommand_Execute_IsExecuted() + { + Mock mediator = new Mock(); + mediator.Setup(m => m.Send(It.IsAny(), It.IsAny())).ReturnsAsync(true); + Mock navigationService = new Mock(); + Mock applicationCache = new Mock(); + Mock dialogService = new Mock(); + Logger.Initialise(NullLogger.Instance); + VoucherSelectOperatorPageViewModel viewModel = new VoucherSelectOperatorPageViewModel(mediator.Object, + navigationService.Object, applicationCache.Object, + dialogService.Object); + viewModel.BackButtonCommand.Execute(null); + + navigationService.Verify(v => v.GoBack(), Times.Once); + } } \ No newline at end of file diff --git a/TransactionMobile.Maui.BusinessLogic/UIServices/INavigationService.cs b/TransactionMobile.Maui.BusinessLogic/UIServices/INavigationService.cs index 237edece..dd6143aa 100644 --- a/TransactionMobile.Maui.BusinessLogic/UIServices/INavigationService.cs +++ b/TransactionMobile.Maui.BusinessLogic/UIServices/INavigationService.cs @@ -4,6 +4,8 @@ public interface INavigationService { #region Methods + Task GoBack(); + Task GoToHome(); Task GoToMobileTopupFailedPage(); diff --git a/TransactionMobile.Maui.BusinessLogic/ViewModels/Admin/AdminPageViewModel.cs b/TransactionMobile.Maui.BusinessLogic/ViewModels/Admin/AdminPageViewModel.cs index 5c525f2f..3485769f 100644 --- a/TransactionMobile.Maui.BusinessLogic/ViewModels/Admin/AdminPageViewModel.cs +++ b/TransactionMobile.Maui.BusinessLogic/ViewModels/Admin/AdminPageViewModel.cs @@ -10,12 +10,10 @@ using Services; using UIServices; - public class AdminPageViewModel : BaseViewModel + public class AdminPageViewModel : ExtendedBaseViewModel { private readonly IMediator Mediator; - - private readonly INavigationService NavigationService; - + private readonly IDeviceService DeviceService; private readonly IApplicationInfoService ApplicationInfoService; @@ -23,10 +21,12 @@ public class AdminPageViewModel : BaseViewModel #region Constructors public AdminPageViewModel(IMediator mediator, INavigationService navigationService, - IDeviceService deviceService, IApplicationInfoService applicationInfoService) + IApplicationCache applicationCache, + IDialogService dialogService, + IDeviceService deviceService, IApplicationInfoService applicationInfoService) : + base(applicationCache,dialogService, navigationService) { this.Mediator = mediator; - this.NavigationService = navigationService; this.DeviceService = deviceService; this.ApplicationInfoService = applicationInfoService; this.ReconciliationCommand = new AsyncCommand(this.ReconciliationCommandExecute); diff --git a/TransactionMobile.Maui.BusinessLogic/ViewModels/ExtendedBaseViewModel.cs b/TransactionMobile.Maui.BusinessLogic/ViewModels/ExtendedBaseViewModel.cs new file mode 100644 index 00000000..f3e92309 --- /dev/null +++ b/TransactionMobile.Maui.BusinessLogic/ViewModels/ExtendedBaseViewModel.cs @@ -0,0 +1,74 @@ +namespace TransactionMobile.Maui.BusinessLogic.ViewModels; + +using System.Windows.Input; +using Maui.UIServices; +using MvvmHelpers; +using MvvmHelpers.Commands; +using MyAccount; +using Services; +using Shared.Logger; +using Support; +using Transactions; +using UIServices; + +public class ExtendedBaseViewModel : BaseViewModel +{ + #region Fields + + protected readonly IApplicationCache ApplicationCache; + + protected readonly IDialogService DialogService; + + protected readonly INavigationService NavigationService; + + #endregion + + #region Constructors + + public ExtendedBaseViewModel(IApplicationCache applicationCache, + IDialogService dialogService, + INavigationService navigationService) { + this.NavigationService = navigationService; + this.ApplicationCache = applicationCache; + this.DialogService = dialogService; + this.BackButtonCommand = new AsyncCommand(this.BackButtonCommandExecute); + } + + #endregion + + #region Properties + + public ICommand BackButtonCommand { get; } + + #endregion + + #region Methods + + protected async Task BackButtonCommandExecute() { + Type type = this.GetType().UnderlyingSystemType; + Task t = type.Name switch { + nameof(TransactionsPageViewModel) => this.ShowHomePage(), + nameof(MyAccountPageViewModel) => this.ShowHomePage(), + nameof(SupportPageViewModel) => this.ShowHomePage(), + nameof(HomePageViewModel) => this.ShowLoginPage(), + _ => this.NavigationService.GoBack() + }; + await t; + } + + private async Task ShowHomePage() { + await this.NavigationService.GoToHome(); + } + + private async Task ShowLoginPage() { + Boolean leave = await this.DialogService.ShowDialog("Title", "Logout Message", "yes", "no"); + if (leave) { + Logger.LogInformation("LogoutCommand called"); + this.ApplicationCache.SetAccessToken(null); + + await this.NavigationService.GoToLoginPage(); + } + } + + #endregion +} \ No newline at end of file diff --git a/TransactionMobile.Maui.BusinessLogic/ViewModels/HomePageViewModel.cs b/TransactionMobile.Maui.BusinessLogic/ViewModels/HomePageViewModel.cs index 93c08550..2b6c8f44 100644 --- a/TransactionMobile.Maui.BusinessLogic/ViewModels/HomePageViewModel.cs +++ b/TransactionMobile.Maui.BusinessLogic/ViewModels/HomePageViewModel.cs @@ -1,38 +1,22 @@ namespace TransactionMobile.Maui.BusinessLogic.ViewModels; using System.Runtime.CompilerServices; -using System.Windows.Input; using Maui.UIServices; using Microsoft.AppCenter; using Microsoft.AppCenter.Distribute; using Models; -using MvvmHelpers; -using MvvmHelpers.Commands; using Services; -using Shared.Logger; using UIServices; -public class HomePageViewModel : BaseViewModel +public class HomePageViewModel : ExtendedBaseViewModel { - #region Fields - - private readonly IApplicationCache ApplicationCache; - - private readonly IDialogService DialogService; - - private readonly INavigationService NavigationService; - - #endregion - #region Constructors - + public HomePageViewModel(IApplicationCache applicationCache, IDialogService dialogService, - INavigationService navigationService) + INavigationService navigationService) :base(applicationCache,dialogService, navigationService) { - this.ApplicationCache = applicationCache; - this.DialogService = dialogService; - this.NavigationService = navigationService; + } public async Task ShowDebugMessage(String message) { @@ -43,19 +27,6 @@ public async Task ShowDebugMessage(String message) { await this.DialogService.ShowDialog("Debug", message, "OK"); } } - public async Task BackButtonClicked() { - - var g = await this.DialogService.ShowDialog("Title", "Message", "yes", "no"); - if (g) { - Logger.LogInformation("LogoutCommand called"); - this.ApplicationCache.SetAccessToken(null); - - await this.NavigationService.GoToLoginPage(); - return false; - } - - return true; - } #endregion diff --git a/TransactionMobile.Maui.BusinessLogic/ViewModels/MyAccount/MyAccountAddressPageViewModel.cs b/TransactionMobile.Maui.BusinessLogic/ViewModels/MyAccount/MyAccountAddressPageViewModel.cs index 94356840..ea6acf96 100644 --- a/TransactionMobile.Maui.BusinessLogic/ViewModels/MyAccount/MyAccountAddressPageViewModel.cs +++ b/TransactionMobile.Maui.BusinessLogic/ViewModels/MyAccount/MyAccountAddressPageViewModel.cs @@ -3,38 +3,41 @@ using Maui.UIServices; using MediatR; using Models; -using MvvmHelpers; using Services; +using UIServices; -public class MyAccountAddressPageViewModel : BaseViewModel +public class MyAccountAddressPageViewModel : ExtendedBaseViewModel { - private readonly INavigationService NavigationService; + #region Fields - private readonly IApplicationCache ApplicationCache; + private AddressModel address; private readonly IMediator Mediator; + #endregion + #region Constructors public MyAccountAddressPageViewModel(INavigationService navigationService, IApplicationCache applicationCache, - IMediator mediator) { - this.NavigationService = navigationService; - this.ApplicationCache = applicationCache; + IDialogService dialogService, + IMediator mediator) : base(applicationCache, dialogService, navigationService) { this.Mediator = mediator; this.Title = "My Addresses"; } - + #endregion - private AddressModel address; + #region Properties - public AddressModel Address{ + public AddressModel Address { get => this.address; set => this.SetProperty(ref this.address, value); } - #region Properties + #endregion + + #region Methods public async Task Initialise(CancellationToken cancellationToken) { MerchantDetailsModel merchantDetails = this.ApplicationCache.GetMerchantDetails(); diff --git a/TransactionMobile.Maui.BusinessLogic/ViewModels/MyAccount/MyAccountContactPageViewModel.cs b/TransactionMobile.Maui.BusinessLogic/ViewModels/MyAccount/MyAccountContactPageViewModel.cs index 540c237e..9d65b493 100644 --- a/TransactionMobile.Maui.BusinessLogic/ViewModels/MyAccount/MyAccountContactPageViewModel.cs +++ b/TransactionMobile.Maui.BusinessLogic/ViewModels/MyAccount/MyAccountContactPageViewModel.cs @@ -5,15 +5,10 @@ using MvvmHelpers; using Services; using TransactionMobile.Maui.BusinessLogic.Models; +using TransactionMobile.Maui.BusinessLogic.UIServices; -public class MyAccountContactPageViewModel : BaseViewModel +public class MyAccountContactPageViewModel : ExtendedBaseViewModel { - private readonly INavigationService NavigationService; - - private readonly IApplicationCache ApplicationCache; - - private readonly IMediator Mediator; - private ContactModel contact; public ContactModel Contact { @@ -23,12 +18,9 @@ public ContactModel Contact { #region Constructors - public MyAccountContactPageViewModel(INavigationService navigationService, IApplicationCache applicationCache, - IMediator mediator) - { - this.NavigationService = navigationService; - this.ApplicationCache = applicationCache; - this.Mediator = mediator; + public MyAccountContactPageViewModel(INavigationService navigationService, + IApplicationCache applicationCache, + IDialogService dialogService) : base(applicationCache, dialogService, navigationService) { this.Title = "My Contacts"; } diff --git a/TransactionMobile.Maui.BusinessLogic/ViewModels/MyAccount/MyAccountDetailsPageViewModel.cs b/TransactionMobile.Maui.BusinessLogic/ViewModels/MyAccount/MyAccountDetailsPageViewModel.cs index 939a89de..a25be1c3 100644 --- a/TransactionMobile.Maui.BusinessLogic/ViewModels/MyAccount/MyAccountDetailsPageViewModel.cs +++ b/TransactionMobile.Maui.BusinessLogic/ViewModels/MyAccount/MyAccountDetailsPageViewModel.cs @@ -5,25 +5,20 @@ using Models; using MvvmHelpers; using Services; +using UIServices; -public class MyAccountDetailsPageViewModel : BaseViewModel +public class MyAccountDetailsPageViewModel : ExtendedBaseViewModel { #region Fields - private readonly IApplicationCache ApplicationCache; - private Decimal availableBalance; private Decimal balance; private DateTime lastStatementDate; - private readonly IMediator Mediator; - private String merchantName; - private readonly INavigationService NavigationService; - private DateTime nextStatementDate; private String settlementSchedule; @@ -34,10 +29,7 @@ public class MyAccountDetailsPageViewModel : BaseViewModel public MyAccountDetailsPageViewModel(INavigationService navigationService, IApplicationCache applicationCache, - IMediator mediator) { - this.NavigationService = navigationService; - this.ApplicationCache = applicationCache; - this.Mediator = mediator; + IDialogService dialogService) : base(applicationCache, dialogService, navigationService) { this.Title = "My Details"; } diff --git a/TransactionMobile.Maui.BusinessLogic/ViewModels/MyAccount/MyAccountPageViewModel.cs b/TransactionMobile.Maui.BusinessLogic/ViewModels/MyAccount/MyAccountPageViewModel.cs index 6744869f..f375f072 100644 --- a/TransactionMobile.Maui.BusinessLogic/ViewModels/MyAccount/MyAccountPageViewModel.cs +++ b/TransactionMobile.Maui.BusinessLogic/ViewModels/MyAccount/MyAccountPageViewModel.cs @@ -12,30 +12,26 @@ using Requests; using Services; using Shared.Logger; + using UIServices; - public class MyAccountPageViewModel : BaseViewModel + public class MyAccountPageViewModel : ExtendedBaseViewModel { #region Fields - private readonly IApplicationCache ApplicationCache; - private DateTime lastLogin; private readonly IMediator Mediator; private String merchantName; - private readonly INavigationService NavigationService; - #endregion #region Constructors public MyAccountPageViewModel(INavigationService navigationService, IApplicationCache applicationCache, - IMediator mediator) { - this.NavigationService = navigationService; - this.ApplicationCache = applicationCache; + IDialogService dialogService, + IMediator mediator) : base(applicationCache, dialogService, navigationService) { this.Mediator = mediator; this.OptionSelectedCommand = new AsyncCommand>(this.OptionSelectedCommandExecute); this.Title = "My Account"; diff --git a/TransactionMobile.Maui.BusinessLogic/ViewModels/Support/SupportPageViewModel.cs b/TransactionMobile.Maui.BusinessLogic/ViewModels/Support/SupportPageViewModel.cs index f300677c..5049d639 100644 --- a/TransactionMobile.Maui.BusinessLogic/ViewModels/Support/SupportPageViewModel.cs +++ b/TransactionMobile.Maui.BusinessLogic/ViewModels/Support/SupportPageViewModel.cs @@ -12,12 +12,10 @@ using Shared.Logger; using UIServices; - public class SupportPageViewModel : BaseViewModel + public class SupportPageViewModel : ExtendedBaseViewModel { #region Fields - private readonly IApplicationCache ApplicationCache; - private readonly IApplicationInfoService ApplicationInfoService; private readonly IDatabaseContext DatabaseContext; @@ -25,9 +23,7 @@ public class SupportPageViewModel : BaseViewModel private readonly IDeviceService DeviceService; private readonly IMediator Mediator; - - private readonly INavigationService NavigationService; - + #endregion #region Constructors @@ -37,15 +33,15 @@ public SupportPageViewModel(IDeviceService deviceService, IDatabaseContext databaseContext, IMediator mediator, INavigationService navigationService, - IApplicationCache applicationCache) { + IApplicationCache applicationCache, + IDialogService dialogService) : base(applicationCache, dialogService, navigationService) + { this.DeviceService = deviceService; this.ApplicationInfoService = applicationInfoService; this.DatabaseContext = databaseContext; this.UploadLogsCommand = new AsyncCommand(this.UploadLogsCommandExecute); this.ViewLogsCommand = new AsyncCommand(this.ViewLogsCommandExecute); this.Mediator = mediator; - this.NavigationService = navigationService; - this.ApplicationCache = applicationCache; this.Title = "Support"; } diff --git a/TransactionMobile.Maui.BusinessLogic/ViewModels/Support/ViewLogsPageViewModel.cs b/TransactionMobile.Maui.BusinessLogic/ViewModels/Support/ViewLogsPageViewModel.cs index 57acd2e3..d6fe4aa9 100644 --- a/TransactionMobile.Maui.BusinessLogic/ViewModels/Support/ViewLogsPageViewModel.cs +++ b/TransactionMobile.Maui.BusinessLogic/ViewModels/Support/ViewLogsPageViewModel.cs @@ -1,11 +1,14 @@ namespace TransactionMobile.Maui.BusinessLogic.ViewModels.Support; +using Maui.UIServices; using MediatR; using Models; using MvvmHelpers; using Requests; +using Services; +using UIServices; -public class ViewLogsPageViewModel : BaseViewModel +public class ViewLogsPageViewModel : ExtendedBaseViewModel { #region Fields @@ -15,7 +18,9 @@ public class ViewLogsPageViewModel : BaseViewModel #region Constructors - public ViewLogsPageViewModel(IMediator mediator) { + public ViewLogsPageViewModel(IMediator mediator, INavigationService navigationService, + IApplicationCache applicationCache, + IDialogService dialogService) : base(applicationCache, dialogService, navigationService) { this.Mediator = mediator; this.Title = "View Logs"; } diff --git a/TransactionMobile.Maui.BusinessLogic/ViewModels/Transactions/MobileTopupFailedPageViewModel.cs b/TransactionMobile.Maui.BusinessLogic/ViewModels/Transactions/MobileTopupFailedPageViewModel.cs index 36cf4b01..134b1dc9 100644 --- a/TransactionMobile.Maui.BusinessLogic/ViewModels/Transactions/MobileTopupFailedPageViewModel.cs +++ b/TransactionMobile.Maui.BusinessLogic/ViewModels/Transactions/MobileTopupFailedPageViewModel.cs @@ -4,6 +4,7 @@ using Maui.UIServices; using MvvmHelpers; using MvvmHelpers.Commands; +using Services; using UIServices; public class MobileTopupFailedPageViewModel : BaseViewModel @@ -12,8 +13,7 @@ public class MobileTopupFailedPageViewModel : BaseViewModel #region Constructors - public MobileTopupFailedPageViewModel(INavigationService navigationService) - { + public MobileTopupFailedPageViewModel(INavigationService navigationService) { this.NavigationService = navigationService; this.CancelledCommand = new AsyncCommand(this.CancelledCommandExecute); this.Title = "Mobile Topup Failed"; diff --git a/TransactionMobile.Maui.BusinessLogic/ViewModels/Transactions/MobileTopupPerformTopupPageViewModel.cs b/TransactionMobile.Maui.BusinessLogic/ViewModels/Transactions/MobileTopupPerformTopupPageViewModel.cs index 4cb361d9..0ae2025e 100644 --- a/TransactionMobile.Maui.BusinessLogic/ViewModels/Transactions/MobileTopupPerformTopupPageViewModel.cs +++ b/TransactionMobile.Maui.BusinessLogic/ViewModels/Transactions/MobileTopupPerformTopupPageViewModel.cs @@ -8,10 +8,11 @@ using MvvmHelpers; using MvvmHelpers.Commands; using Requests; +using Services; using UIServices; using Command = Microsoft.Maui.Controls.Command; -public class MobileTopupPerformTopupPageViewModel : BaseViewModel, IQueryAttributable +public class MobileTopupPerformTopupPageViewModel : ExtendedBaseViewModel, IQueryAttributable { #region Fields @@ -21,8 +22,6 @@ public class MobileTopupPerformTopupPageViewModel : BaseViewModel, IQueryAttribu private readonly IMediator Mediator; - private readonly INavigationService NavigationService; - private Decimal topupAmount; #endregion @@ -37,10 +36,12 @@ public void ApplyQueryAttributes(IDictionary query) this.TopupAmount = Decimal.Parse(HttpUtility.UrlDecode(query[nameof(TopupAmount)].ToString())); } - public MobileTopupPerformTopupPageViewModel(IMediator mediator, INavigationService navigationService) + public MobileTopupPerformTopupPageViewModel(IMediator mediator, + INavigationService navigationService, + IApplicationCache applicationCache, + IDialogService dialogService) : base(applicationCache, dialogService, navigationService) { this.Mediator = mediator; - this.NavigationService = navigationService; this.PerformTopupCommand = new AsyncCommand(this.PerformTopupCommandExecute); this.CustomerMobileNumberEntryCompletedCommand = new Command(this.CustomerMobileNumberEntryCompletedCommandExecute); this.TopupAmountEntryCompletedCommand = new Command(this.TopupAmountEntryCompletedCommandExecute); diff --git a/TransactionMobile.Maui.BusinessLogic/ViewModels/Transactions/MobileTopupSelectOperatorPageViewModel.cs b/TransactionMobile.Maui.BusinessLogic/ViewModels/Transactions/MobileTopupSelectOperatorPageViewModel.cs index 68f34008..40241f20 100644 --- a/TransactionMobile.Maui.BusinessLogic/ViewModels/Transactions/MobileTopupSelectOperatorPageViewModel.cs +++ b/TransactionMobile.Maui.BusinessLogic/ViewModels/Transactions/MobileTopupSelectOperatorPageViewModel.cs @@ -8,24 +8,23 @@ using MvvmHelpers; using MvvmHelpers.Commands; using Requests; +using Services; using UIServices; -public class MobileTopupSelectOperatorPageViewModel : BaseViewModel +public class MobileTopupSelectOperatorPageViewModel : ExtendedBaseViewModel { #region Fields private readonly IMediator Mediator; - private readonly INavigationService NavigationService; - #endregion #region Constructors - public MobileTopupSelectOperatorPageViewModel(IMediator mediator, INavigationService navigationService) + public MobileTopupSelectOperatorPageViewModel(IMediator mediator, INavigationService navigationService, IDialogService dialogService, + IApplicationCache applicationCache): base(applicationCache,dialogService, navigationService) { this.Mediator = mediator; - this.NavigationService = navigationService; this.OperatorSelectedCommand = new AsyncCommand>(this.OperatorSelectedCommandExecute); this.Title = "Select an Operator"; } diff --git a/TransactionMobile.Maui.BusinessLogic/ViewModels/Transactions/MobileTopupSelectProductPageViewModel.cs b/TransactionMobile.Maui.BusinessLogic/ViewModels/Transactions/MobileTopupSelectProductPageViewModel.cs index b6baee6b..d0f5ae7b 100644 --- a/TransactionMobile.Maui.BusinessLogic/ViewModels/Transactions/MobileTopupSelectProductPageViewModel.cs +++ b/TransactionMobile.Maui.BusinessLogic/ViewModels/Transactions/MobileTopupSelectProductPageViewModel.cs @@ -10,16 +10,15 @@ using MvvmHelpers; using MvvmHelpers.Commands; using Requests; +using Services; using UIServices; -public class MobileTopupSelectProductPageViewModel : BaseViewModel, IQueryAttributable +public class MobileTopupSelectProductPageViewModel : ExtendedBaseViewModel, IQueryAttributable { #region Fields private readonly IMediator Mediator; - private readonly INavigationService NavigationService; - #endregion #region Constructors @@ -29,10 +28,10 @@ public void ApplyQueryAttributes(IDictionary query) this.OperatorIdentifier = HttpUtility.UrlDecode(query[nameof(OperatorIdentifier)].ToString()); } - public MobileTopupSelectProductPageViewModel(IMediator mediator, INavigationService navigationService) + public MobileTopupSelectProductPageViewModel(IMediator mediator, INavigationService navigationService, + IApplicationCache applicationCache, IDialogService dialogService) :base(applicationCache, dialogService, navigationService) { this.Mediator = mediator; - this.NavigationService = navigationService; this.ProductSelectedCommand = new AsyncCommand>(this.ProductSelectedCommandExecute); this.Title = "Select a Product"; } diff --git a/TransactionMobile.Maui.BusinessLogic/ViewModels/Transactions/MobileTopupSuccessPageViewModel.cs b/TransactionMobile.Maui.BusinessLogic/ViewModels/Transactions/MobileTopupSuccessPageViewModel.cs index 7ae52bf6..5cc99d01 100644 --- a/TransactionMobile.Maui.BusinessLogic/ViewModels/Transactions/MobileTopupSuccessPageViewModel.cs +++ b/TransactionMobile.Maui.BusinessLogic/ViewModels/Transactions/MobileTopupSuccessPageViewModel.cs @@ -4,6 +4,7 @@ using Maui.UIServices; using MvvmHelpers; using MvvmHelpers.Commands; + using Services; using UIServices; public class MobileTopupSuccessPageViewModel : BaseViewModel diff --git a/TransactionMobile.Maui.BusinessLogic/ViewModels/Transactions/TransactionsPageViewModel.cs b/TransactionMobile.Maui.BusinessLogic/ViewModels/Transactions/TransactionsPageViewModel.cs index 59ae0517..07f8cef7 100644 --- a/TransactionMobile.Maui.BusinessLogic/ViewModels/Transactions/TransactionsPageViewModel.cs +++ b/TransactionMobile.Maui.BusinessLogic/ViewModels/Transactions/TransactionsPageViewModel.cs @@ -4,17 +4,17 @@ using Maui.UIServices; using MvvmHelpers; using MvvmHelpers.Commands; + using Services; using UIServices; - public class TransactionsPageViewModel : BaseViewModel + public class TransactionsPageViewModel : ExtendedBaseViewModel { - private readonly INavigationService NavigationService; - #region Constructors - public TransactionsPageViewModel(INavigationService navigationService) + public TransactionsPageViewModel(INavigationService navigationService, + IApplicationCache applicationCache, + IDialogService dialogService) : base(applicationCache, dialogService, navigationService) { - this.NavigationService = navigationService; this.MobileTopupCommand = new AsyncCommand(this.MobileTopupCommandExecute); this.MobileWalletCommand = new AsyncCommand(this.MobileWalletCommandExecute); this.BillPaymentCommand = new AsyncCommand(this.BillPaymentCommandExecute); diff --git a/TransactionMobile.Maui.BusinessLogic/ViewModels/Transactions/VoucherIssueFailedPageViewModel.cs b/TransactionMobile.Maui.BusinessLogic/ViewModels/Transactions/VoucherIssueFailedPageViewModel.cs index 2e9391a5..ce410663 100644 --- a/TransactionMobile.Maui.BusinessLogic/ViewModels/Transactions/VoucherIssueFailedPageViewModel.cs +++ b/TransactionMobile.Maui.BusinessLogic/ViewModels/Transactions/VoucherIssueFailedPageViewModel.cs @@ -4,6 +4,7 @@ using Maui.UIServices; using MvvmHelpers; using MvvmHelpers.Commands; +using Services; using UIServices; public class VoucherIssueFailedPageViewModel : BaseViewModel diff --git a/TransactionMobile.Maui.BusinessLogic/ViewModels/Transactions/VoucherIssueSuccessPageViewModel.cs b/TransactionMobile.Maui.BusinessLogic/ViewModels/Transactions/VoucherIssueSuccessPageViewModel.cs index d73ab776..2a758e54 100644 --- a/TransactionMobile.Maui.BusinessLogic/ViewModels/Transactions/VoucherIssueSuccessPageViewModel.cs +++ b/TransactionMobile.Maui.BusinessLogic/ViewModels/Transactions/VoucherIssueSuccessPageViewModel.cs @@ -4,6 +4,7 @@ using Maui.UIServices; using MvvmHelpers; using MvvmHelpers.Commands; + using Services; using UIServices; public class VoucherIssueSuccessPageViewModel : BaseViewModel diff --git a/TransactionMobile.Maui.BusinessLogic/ViewModels/Transactions/VoucherPerformIssuePageViewModel.cs b/TransactionMobile.Maui.BusinessLogic/ViewModels/Transactions/VoucherPerformIssuePageViewModel.cs index 88e46c16..48159a39 100644 --- a/TransactionMobile.Maui.BusinessLogic/ViewModels/Transactions/VoucherPerformIssuePageViewModel.cs +++ b/TransactionMobile.Maui.BusinessLogic/ViewModels/Transactions/VoucherPerformIssuePageViewModel.cs @@ -7,10 +7,11 @@ using MvvmHelpers; using MvvmHelpers.Commands; using Requests; +using Services; using UIServices; using Command = Microsoft.Maui.Controls.Command; -public class VoucherPerformIssuePageViewModel : BaseViewModel, IQueryAttributable +public class VoucherPerformIssuePageViewModel : ExtendedBaseViewModel, IQueryAttributable { #region Fields @@ -21,9 +22,7 @@ public class VoucherPerformIssuePageViewModel : BaseViewModel, IQueryAttributabl private String recipientEmailAddress; private readonly IMediator Mediator; - - private readonly INavigationService NavigationService; - + private Decimal voucherAmount; #endregion @@ -38,10 +37,12 @@ public void ApplyQueryAttributes(IDictionary query) this.VoucherAmount = Decimal.Parse(HttpUtility.UrlDecode(query[nameof(this.VoucherAmount)].ToString())); } - public VoucherPerformIssuePageViewModel(IMediator mediator, INavigationService navigationService) + public VoucherPerformIssuePageViewModel(INavigationService navigationService, + IApplicationCache applicationCache, + IDialogService dialogService, + IMediator mediator) : base(applicationCache, dialogService, navigationService) { this.Mediator = mediator; - this.NavigationService = navigationService; this.IssueVoucherCommand = new AsyncCommand(this.IssueVoucherCommandExecute); this.RecipientMobileNumberEntryCompletedCommand = new Command(this.RecipientMobileNumberEntryCompletedCommandExecute); this.RecipientEmailAddressEntryCompletedCommand = new Command(this.RecipientEmailAddressEntryCompletedCommandExecute); diff --git a/TransactionMobile.Maui.BusinessLogic/ViewModels/Transactions/VoucherSelectOperatorPageViewModel.cs b/TransactionMobile.Maui.BusinessLogic/ViewModels/Transactions/VoucherSelectOperatorPageViewModel.cs index 6cdc36fb..1c45e1e2 100644 --- a/TransactionMobile.Maui.BusinessLogic/ViewModels/Transactions/VoucherSelectOperatorPageViewModel.cs +++ b/TransactionMobile.Maui.BusinessLogic/ViewModels/Transactions/VoucherSelectOperatorPageViewModel.cs @@ -8,24 +8,25 @@ using MvvmHelpers; using MvvmHelpers.Commands; using Requests; +using Services; using UIServices; -public class VoucherSelectOperatorPageViewModel : BaseViewModel +public class VoucherSelectOperatorPageViewModel : ExtendedBaseViewModel { #region Fields private readonly IMediator Mediator; - private readonly INavigationService NavigationService; - #endregion #region Constructors - public VoucherSelectOperatorPageViewModel(IMediator mediator, INavigationService navigationService) + public VoucherSelectOperatorPageViewModel(IMediator mediator, INavigationService navigationService, + IApplicationCache applicationCache, + IDialogService dialogService) : base(applicationCache, dialogService, navigationService) + { this.Mediator = mediator; - this.NavigationService = navigationService; this.OperatorSelectedCommand = new AsyncCommand>(this.OperatorSelectedCommandExecute); this.Title = "Select an Operator"; } diff --git a/TransactionMobile.Maui.BusinessLogic/ViewModels/Transactions/VoucherSelectProductPageViewModel.cs b/TransactionMobile.Maui.BusinessLogic/ViewModels/Transactions/VoucherSelectProductPageViewModel.cs index d05b582c..2050d7a2 100644 --- a/TransactionMobile.Maui.BusinessLogic/ViewModels/Transactions/VoucherSelectProductPageViewModel.cs +++ b/TransactionMobile.Maui.BusinessLogic/ViewModels/Transactions/VoucherSelectProductPageViewModel.cs @@ -9,16 +9,15 @@ using MvvmHelpers; using MvvmHelpers.Commands; using Requests; +using Services; using UIServices; -public class VoucherSelectProductPageViewModel : BaseViewModel, IQueryAttributable +public class VoucherSelectProductPageViewModel : ExtendedBaseViewModel, IQueryAttributable { #region Fields private readonly IMediator Mediator; - private readonly INavigationService NavigationService; - #endregion #region Constructors @@ -28,10 +27,11 @@ public void ApplyQueryAttributes(IDictionary query) this.OperatorIdentifier = HttpUtility.UrlDecode(query[nameof(this.OperatorIdentifier)].ToString()); } - public VoucherSelectProductPageViewModel(IMediator mediator, INavigationService navigationService) + public VoucherSelectProductPageViewModel(IMediator mediator, INavigationService navigationService, + IApplicationCache applicationCache, + IDialogService dialogService) : base(applicationCache, dialogService, navigationService) { this.Mediator = mediator; - this.NavigationService = navigationService; this.ProductSelectedCommand = new AsyncCommand>(this.ProductSelectedCommandExecute); this.Title = "Select a Product"; } diff --git a/TransactionMobile.Maui.UiTests/Features/Profile.feature.cs b/TransactionMobile.Maui.UiTests/Features/Profile.feature.cs index 49ac1d8b..1d90057d 100644 --- a/TransactionMobile.Maui.UiTests/Features/Profile.feature.cs +++ b/TransactionMobile.Maui.UiTests/Features/Profile.feature.cs @@ -113,12 +113,14 @@ public virtual void FeatureBackground() [NUnit.Framework.TestAttribute()] [NUnit.Framework.DescriptionAttribute("View Merchant Addresses")] + [NUnit.Framework.CategoryAttribute("PRTest")] public void ViewMerchantAddresses() { - string[] tagsOfScenario = ((string[])(null)); + string[] tagsOfScenario = new string[] { + "PRTest"}; System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("View Merchant Addresses", null, tagsOfScenario, argumentsOfScenario, featureTags); -#line 14 +#line 15 this.ScenarioInitialize(scenarioInfo); #line hidden if ((TagHelper.ContainsIgnoreTag(tagsOfScenario) || TagHelper.ContainsIgnoreTag(featureTags))) @@ -131,10 +133,10 @@ public void ViewMerchantAddresses() #line 4 this.FeatureBackground(); #line hidden -#line 15 +#line 16 testRunner.When("I tap on the Addresses button", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); #line hidden -#line 16 +#line 17 testRunner.Then("the Address List Page is displayed", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); #line hidden TechTalk.SpecFlow.Table table1 = new TechTalk.SpecFlow.Table(new string[] { @@ -153,7 +155,7 @@ public void ViewMerchantAddresses() "Town", "Region", "TE57 1NG"}); -#line 17 +#line 18 testRunner.And("the Primary Address is displayed", ((string)(null)), table1, "And "); #line hidden } @@ -167,7 +169,7 @@ public void ViewMerchantContacts() string[] tagsOfScenario = ((string[])(null)); System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("View Merchant Contacts", null, tagsOfScenario, argumentsOfScenario, featureTags); -#line 21 +#line 22 this.ScenarioInitialize(scenarioInfo); #line hidden if ((TagHelper.ContainsIgnoreTag(tagsOfScenario) || TagHelper.ContainsIgnoreTag(featureTags))) @@ -180,10 +182,10 @@ public void ViewMerchantContacts() #line 4 this.FeatureBackground(); #line hidden -#line 22 +#line 23 testRunner.When("I tap on the Contacts button", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); #line hidden -#line 23 +#line 24 testRunner.Then("the Contact List Page is displayed", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); #line hidden TechTalk.SpecFlow.Table table2 = new TechTalk.SpecFlow.Table(new string[] { @@ -194,7 +196,7 @@ public void ViewMerchantContacts() "Test Contact", "stuart_ferguson1@outlook.com", "123456789"}); -#line 24 +#line 25 testRunner.And("the Primary Contact is displayed", ((string)(null)), table2, "And "); #line hidden } @@ -208,7 +210,7 @@ public void ViewMerchantDetails() string[] tagsOfScenario = ((string[])(null)); System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("View Merchant Details", null, tagsOfScenario, argumentsOfScenario, featureTags); -#line 28 +#line 29 this.ScenarioInitialize(scenarioInfo); #line hidden if ((TagHelper.ContainsIgnoreTag(tagsOfScenario) || TagHelper.ContainsIgnoreTag(featureTags))) @@ -221,10 +223,10 @@ public void ViewMerchantDetails() #line 4 this.FeatureBackground(); #line hidden -#line 29 +#line 30 testRunner.When("I tap on the Account Info button", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); #line hidden -#line 30 +#line 31 testRunner.Then("the Account Info Page is displayed", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); #line hidden TechTalk.SpecFlow.Table table3 = new TechTalk.SpecFlow.Table(new string[] { @@ -241,7 +243,7 @@ public void ViewMerchantDetails() "01/08/2022", "01/09/2022", "Monthly"}); -#line 31 +#line 32 testRunner.And("the Account Info is displayed", ((string)(null)), table3, "And "); #line hidden } diff --git a/TransactionMobile.Maui/Pages/AppHome/HomePage.xaml b/TransactionMobile.Maui/Pages/AppHome/HomePage.xaml index dc366382..8132ddd6 100644 --- a/TransactionMobile.Maui/Pages/AppHome/HomePage.xaml +++ b/TransactionMobile.Maui/Pages/AppHome/HomePage.xaml @@ -10,5 +10,6 @@