Beispiel #1
0
        public async Task ShouldNavigateToConfirmationPage()
        {
            var accountService = new Mock <IAccountService>();

            accountService.Setup(s => s.SignUp(It.IsAny <SignUpRequest>())).ReturnsAsync(new SignUpResponseModel(1)).Verifiable();

            viewService
            .Setup(m => m.SetCurrentPage(It.Is((BaseViewModel p) => p.GetType() == typeof(ConfirmationCodeEntryViewModel))))
            .Verifiable();

            ConfirmationCodeEntryViewModel CreateConfirmationCodeEntryViewModel(int requestId)
            => new ConfirmationCodeEntryViewModel(requestId, null, null, null, null, null, null);

            var viewModel = new SignUpPageViewModel(accountService.Object, CreateConfirmationCodeEntryViewModel, dataFlow.Object, viewService.Object, () => phoneService.Object, deviceInfo.Object, connectivity.Object, appInfo.Object)
            {
                View         = view.Object,
                FirstName    = { Value = "Jhon" },
                LastName     = { Value = "Smith" },
                MobileNumber = { Value = "+614245373" },
                EmailAddress = { Value = "*****@*****.**" }
            };

            Assert.True(viewModel.CanSignUp());

            await viewModel.SignUp();

            // Assert that there is a naviation call to confirmation page
            viewService.Verify();

            accountService.Verify();
        }
Beispiel #2
0
        public void ValidationTest()
        {
            var viewModel = new SignUpPageViewModel(new Mock <IAccountService>().Object, null, dataFlow.Object, viewService.Object, () => phoneService.Object, deviceInfo.Object, connectivity.Object, appInfo.Object)
            {
                View         = view.Object,
                FirstName    = { Value = "" },
                LastName     = { Value = "Smith" },
                MobileNumber = { Value = "+614245373" },
                EmailAddress = { Value = "*****@*****.**" }
            };

            Assert.False(viewModel.CanSignUp());

            viewService.Verify(m => m.SetCurrentPage(It.IsAny <BaseViewModel>()), Times.Never);
        }