Ejemplo n.º 1
0
        public void LoginCommand__ShouldNotSignInOnInvalidCredentials(string username, string password)
        {
            // ARRANGE
            var mockNavigationService = new Mock <INavigationService>();

            mockNavigationService.Setup(n => n.NavigateAsync(It.IsAny <string>(), It.IsAny <INavigationParameters>()))
            .ReturnsAsync(new Mock <INavigationResult>().Object);

            var mockDialogService = new Mock <IPageDialogService>();

            mockDialogService.Setup(d => d.DisplayAlertAsync(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>()))
            .Returns(Task.CompletedTask);

            var mockSignInService = new Mock <ISignInService>();

            mockSignInService.Setup(s => s.SignInAsync(It.IsAny <UserDto>()))
            .ReturnsAsync(false);

            var viewModel = new SignInPageViewModel(mockNavigationService.Object, mockDialogService.Object, mockSignInService.Object)
            {
                Username = username,
                Password = password
            };

            // ACT
            Should.NotThrow(viewModel.LoginCommand.Execute);

            // ASSERT
            mockNavigationService.Verify(n => n.NavigateAsync(It.IsAny <string>(), It.IsAny <INavigationParameters>()), Times.Never);
            mockSignInService.Verify(s => s.SignInAsync(It.IsAny <UserDto>()), Times.Never);
            mockDialogService.Verify(d => d.DisplayAlertAsync(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>()), Times.Once);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="SignInPresenter" /> class.
 /// </summary>
 /// <param name="navigationService">The navigation service.</param>
 /// <param name="signInPage">The sign in page.</param>
 /// <param name="signInPageViewModel">The sign in page view model.</param>
 /// <param name="securityServiceClient">The security service client.</param>
 public SignInPresenter(INavigationService navigationService,
                        ISignInPage signInPage, SignInPageViewModel signInPageViewModel,
                        ISignedInGolfClubAdministratorPage signedInGolfClubAdministratorPage,
                        ISecurityServiceClient securityServiceClient)
 {
     this.NavigationService   = navigationService;
     this.SignInPage          = signInPage;
     this.SignInPageViewModel = signInPageViewModel;
     this.SignedInGolfClubAdministratorPage = signedInGolfClubAdministratorPage;
     this.SecurityServiceClient             = securityServiceClient;
 }
Ejemplo n.º 3
0
        public SignInPage()
        {
            InitializeComponent();

            BindingContext = new SignInPageViewModel();

            CreateGrid();
            CreateViews();
            AddViewsToGrid();
            CreateContentLayout();
        }
 public SignInPage(SignInPageViewModel loginPageViewModel) : base(loginPageViewModel)
 {
     InitializeComponent();
 }
Ejemplo n.º 5
0
 public SignInPage()
 {
     InitializeComponent();
     _viewModel = new SignInPageViewModel();
 }
Ejemplo n.º 6
0
 public SignInPage()
 {
     InitializeComponent();
     BindingContext = new SignInPageViewModel();
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Initializes the specified view model.
 /// </summary>
 /// <param name="viewModel">The view model.</param>
 public void Init(SignInPageViewModel viewModel)
 {
     this.ViewModel = viewModel;
     txtEmailAddress.TextChanged += TxtEmailAddress_TextChanged;
     txtPassword.TextChanged     += TxtPassword_TextChanged;
 }
Ejemplo n.º 8
0
 public SignInPage()
 {
     this.InitializeComponent();
     ViewModel      = (SignInPageViewModel)DataContext;
     ViewModel.View = this;
 }