/// <summary> /// Return an auth token of a test profile /// </summary> /// <returns>Auth token</returns> private async Task<string> GetTestToken() { DedaloClient client = new DedaloClient(); DedaloResponse<Utente> response = await client.SignIn("test", "ciao"); return response.Data.AuthToken ?? null; }
public async Task TestAuthWithAuthToken() { DedaloClient client = new DedaloClient(string.Empty); DedaloResponse<Utente> response = await client.SignIn(username, password); Utente user = response.Data; Assert.IsNotNull(user); }
public async Task TestAuthWithDifferentUserAgent() { DedaloClient client = new DedaloClient(string.Empty, "user-agent1"); DedaloResponse<Utente> response = await client.SignIn(username, password); Utente user = response.Data; Assert.IsNotNull(user); }
public async Task TestAuthWithDefaultValues() { DedaloClient client = new DedaloClient(); DedaloResponse<Utente> response = await client.SignIn(username, password); Utente user = response.Data; Assert.IsNotNull(user); }
public async void DoLogin() { if (string.IsNullOrWhiteSpace(this.username) || string.IsNullOrWhiteSpace(this.password)) { MessageBoxHelper.Show( Properties.Resources.LoginMissingField, Properties.Resources.MessageBoxErrorTitle, MessageBoxButton.OK, MessageBoxImage.Information); return; } DedaloClient client = new DedaloClient(); DedaloResponse<Utente> loginResponse = await client.SignIn(this.username, this.password); if (loginResponse.Error != null) { if (loginResponse.Error.Code == 1) { // wrong username MessageBoxHelper.Show( Properties.Resources.WrongUsername, Properties.Resources.MessageBoxErrorTitle, MessageBoxButton.OK, MessageBoxImage.Error); } else if (loginResponse.Error.Code == 13) { // wrong password MessageBoxHelper.Show( Properties.Resources.WrongPassword, Properties.Resources.MessageBoxErrorTitle, MessageBoxButton.OK, MessageBoxImage.Error); } else { // general error MessageBoxHelper.Show( Properties.Resources.GeneralErrorMessage, Properties.Resources.MessageBoxErrorTitle, MessageBoxButton.OK, MessageBoxImage.Error); } } else { Constants.ActualUser = loginResponse.Data; } }