diff --git a/TransactionProcessor.Mobile.BusinessLogic.Tests/ViewModelTests/HomePageViewModelTests.cs b/TransactionProcessor.Mobile.BusinessLogic.Tests/ViewModelTests/HomePageViewModelTests.cs index f34dc0541..b2a3c222f 100644 --- a/TransactionProcessor.Mobile.BusinessLogic.Tests/ViewModelTests/HomePageViewModelTests.cs +++ b/TransactionProcessor.Mobile.BusinessLogic.Tests/ViewModelTests/HomePageViewModelTests.cs @@ -63,4 +63,44 @@ public void HomePageViewModel_BackButtonCommand_Execute_UserSelectsNotToLogout_L It.IsAny(), It.IsAny()), Times.Once); } + + [Fact] + public void HomePageViewModel_GoToTransactionsCommand_Execute_TransactionsPageDisplayed() + { + this.viewModel.GoToTransactionsCommand.Execute(null); + + this.navigationService.Verify(n => n.GoToTransactions(), Times.Once); + } + + [Fact] + public void HomePageViewModel_GoToMobileTopupCommand_Execute_MobileTopupSelectOperatorPageDisplayed() + { + this.viewModel.GoToMobileTopupCommand.Execute(null); + + this.navigationService.Verify(n => n.GoToMobileTopupSelectOperatorPage(), Times.Once); + } + + [Fact] + public void HomePageViewModel_GoToBillPaymentCommand_Execute_BillPaymentSelectOperatorPageDisplayed() + { + this.viewModel.GoToBillPaymentCommand.Execute(null); + + this.navigationService.Verify(n => n.GoToBillPaymentSelectOperatorPage(), Times.Once); + } + + [Fact] + public void HomePageViewModel_GoToVoucherCommand_Execute_VoucherSelectOperatorPageDisplayed() + { + this.viewModel.GoToVoucherCommand.Execute(null); + + this.navigationService.Verify(n => n.GoToVoucherSelectOperatorPage(), Times.Once); + } + + [Fact] + public void HomePageViewModel_GoToAdminCommand_Execute_AdminPageDisplayed() + { + this.viewModel.GoToAdminCommand.Execute(null); + + this.navigationService.Verify(n => n.GoToAdminPage(), Times.Once); + } } \ No newline at end of file diff --git a/TransactionProcessor.Mobile.BusinessLogic/Logging/Logger.cs b/TransactionProcessor.Mobile.BusinessLogic/Logging/Logger.cs index 007fb9f0c..230039e52 100644 --- a/TransactionProcessor.Mobile.BusinessLogic/Logging/Logger.cs +++ b/TransactionProcessor.Mobile.BusinessLogic/Logging/Logger.cs @@ -58,6 +58,10 @@ public static void Initialise(ILogger loggerObject) /// The exception. public static void LogCritical(String message, Exception exception) { + if (Logger.LoggerObjects == null || Logger.LoggerObjects.Any() == false) { + Console.WriteLine($"{message}: {exception}"); + return; + } foreach (ILogger loggerObject in Logger.LoggerObjects) { loggerObject.LogCritical(message, exception); } @@ -70,6 +74,10 @@ public static void LogCritical(String message, Exception exception) /// The message. public static void LogDebug(String message) { + if (Logger.LoggerObjects == null || Logger.LoggerObjects.Any() == false) { + Console.WriteLine(message); + return; + } foreach (ILogger loggerObject in Logger.LoggerObjects) { loggerObject.LogDebug(message); @@ -82,6 +90,10 @@ public static void LogDebug(String message) /// The exception. public static void LogError(String message, Exception exception) { + if (Logger.LoggerObjects == null || Logger.LoggerObjects.Any() == false) { + Console.WriteLine($"{message}: {exception}"); + return; + } foreach (ILogger loggerObject in Logger.LoggerObjects) { loggerObject.LogError(message, exception); } @@ -109,6 +121,10 @@ public static void LogInformation(String message) /// The message. public static void LogTrace(String message) { + if (Logger.LoggerObjects == null || Logger.LoggerObjects.Any() == false) { + Console.WriteLine(message); + return; + } foreach (ILogger loggerObject in Logger.LoggerObjects) { loggerObject.LogTrace(message); } @@ -120,6 +136,10 @@ public static void LogTrace(String message) /// The message. public static void LogWarning(String message) { + if (Logger.LoggerObjects == null || Logger.LoggerObjects.Any() == false) { + Console.WriteLine(message); + return; + } foreach (ILogger loggerObject in Logger.LoggerObjects) { loggerObject.LogWarning(message); diff --git a/TransactionProcessor.Mobile.BusinessLogic/UIServices/INavigationService.cs b/TransactionProcessor.Mobile.BusinessLogic/UIServices/INavigationService.cs index d07ae4c08..9dbc5ac5f 100644 --- a/TransactionProcessor.Mobile.BusinessLogic/UIServices/INavigationService.cs +++ b/TransactionProcessor.Mobile.BusinessLogic/UIServices/INavigationService.cs @@ -65,5 +65,7 @@ Task GoToBillPaymentPayBillPage(ProductDetails productDetails, Task GoToReportsSalesAnalysis(); Task GoToReportsBalanceAnalysis(); + Task GoToTransactions(); + #endregion } \ No newline at end of file diff --git a/TransactionProcessor.Mobile.BusinessLogic/ViewModels/HomePageViewModel.cs b/TransactionProcessor.Mobile.BusinessLogic/ViewModels/HomePageViewModel.cs index 9cc4b25c3..3d60aef9e 100644 --- a/TransactionProcessor.Mobile.BusinessLogic/ViewModels/HomePageViewModel.cs +++ b/TransactionProcessor.Mobile.BusinessLogic/ViewModels/HomePageViewModel.cs @@ -1,4 +1,6 @@ using System.Diagnostics.CodeAnalysis; +using System.Windows.Input; +using MvvmHelpers.Commands; using TransactionProcessor.Mobile.BusinessLogic.Services; using TransactionProcessor.Mobile.BusinessLogic.UIServices; @@ -13,6 +15,16 @@ public HomePageViewModel(IApplicationCache applicationCache, INavigationService navigationService, INavigationParameterService navigationParameterService) :base(applicationCache,dialogService, navigationService, deviceService,navigationParameterService) { - + this.GoToMobileTopupCommand = new AsyncCommand(async () => await this.NavigationService.GoToMobileTopupSelectOperatorPage()); + this.GoToBillPaymentCommand = new AsyncCommand(async () => await this.NavigationService.GoToBillPaymentSelectOperatorPage()); + this.GoToVoucherCommand = new AsyncCommand(async () => await this.NavigationService.GoToVoucherSelectOperatorPage()); + this.GoToAdminCommand = new AsyncCommand(async () => await this.NavigationService.GoToAdminPage()); + this.GoToTransactionsCommand = new AsyncCommand(async () => await this.NavigationService.GoToTransactions()); } + + public ICommand GoToMobileTopupCommand { get; } + public ICommand GoToBillPaymentCommand { get; } + public ICommand GoToVoucherCommand { get; } + public ICommand GoToAdminCommand { get; } + public ICommand GoToTransactionsCommand { get; } } \ No newline at end of file diff --git a/TransactionProcessor.Mobile/Pages/AppHome/HomePage.xaml b/TransactionProcessor.Mobile/Pages/AppHome/HomePage.xaml index ad32197be..d6fad0a57 100644 --- a/TransactionProcessor.Mobile/Pages/AppHome/HomePage.xaml +++ b/TransactionProcessor.Mobile/Pages/AppHome/HomePage.xaml @@ -4,13 +4,124 @@ x:Class="TransactionProcessor.Mobile.Pages.AppHome.HomePage" xmlns:controls="using:TransactionProcessor.Mobile.Controls" xmlns:common="using:TransactionProcessor.Mobile.Pages.Common" - Shell.NavBarIsVisible="False"> - - - -