public void OnNavigatingTo__ShouldSetDefaultValuesWithWrongNavigationParameters(string recipient, string operationName, int?amount) { // ARRANGE var parameters = new NavigationParameters { { nameof(recipient), recipient }, { nameof(operationName), operationName }, { nameof(amount), amount } }; var mockNavigationService = new Mock <INavigationService>(); var vm = new BlikConfirmationPageViewModel(mockNavigationService.Object); // ACT Should.NotThrow(() => vm.OnNavigatingTo(parameters)); // ASSERT vm.Recipient.ShouldBeSameAs(recipient); vm.OperationName.ShouldBeSameAs(operationName); if (amount.HasValue) { vm.Amount.ShouldBe(amount.Value); } else { vm.Amount.ShouldBe(0); } }
public void OnNavigatingTo__ShouldParseNavigationParametersCorrectly(string recipient, string operationName, int amount) { // ARRANGE var parameters = new NavigationParameters { { nameof(recipient), recipient }, { nameof(operationName), operationName }, { nameof(amount), amount } }; var mockNavigationService = new Mock <INavigationService>(); var vm = new BlikConfirmationPageViewModel(mockNavigationService.Object); // ACT Should.NotThrow(() => vm.OnNavigatingTo(parameters)); // ASSERT vm.Recipient.ShouldBeSameAs(recipient); vm.OperationName.ShouldBeSameAs(operationName); vm.Amount.ShouldBe(amount); }