public void BadClientId() { var authenticator = new PasswordFlowAuthenticator("x", SalesforceConfig.ClientSecret, SalesforceConfig.Username, SalesforceConfig.Password, SalesforceConfig.AuthEndpoint, _httpClient); var ex = Assert.Throws <AuthenticationException>(() => authenticator.GetAuthInfo()); Assert.Equal("invalid_client_id: client identifier invalid", ex.Message); }
public void BadPassword() { var authenticator = new PasswordFlowAuthenticator(SalesforceConfig.ClientId, SalesforceConfig.ClientSecret, SalesforceConfig.Username, "x", SalesforceConfig.AuthEndpoint, _httpClient); var ex = Assert.Throws <AuthenticationException>(() => authenticator.GetAuthInfo()); Assert.Equal("invalid_grant: authentication failure", ex.Message); }
public void BadAuthEndpoint() { var authenticator = new PasswordFlowAuthenticator(SalesforceConfig.ClientId, SalesforceConfig.ClientSecret, SalesforceConfig.Username, SalesforceConfig.Password, SalesforceConfig.AuthEndpoint + "x", _httpClient); var ex = Assert.Throws <AuthenticationException>(() => authenticator.GetAuthInfo()); Assert.StartsWith("An error occured authenticating, see inner exception:", ex.Message); }
public void GoodLogin() { var authenticator = new PasswordFlowAuthenticator(SalesforceConfig.ClientId, SalesforceConfig.ClientSecret, SalesforceConfig.Username, SalesforceConfig.Password, SalesforceConfig.AuthEndpoint, _httpClient); var authResult = authenticator.GetAuthInfo(); Assert.True(Uri.IsWellFormedUriString(authResult.Url, UriKind.Absolute)); Assert.False(string.IsNullOrWhiteSpace(authResult.Url)); }