public void OneTimeSetUp() { _clientId = Environment.GetEnvironmentVariable("AUPHONIC_CLIENT_ID"); _clientSecret = Environment.GetEnvironmentVariable("AUPHONIC_CLIENT_SECRET"); _username = Environment.GetEnvironmentVariable("AUPHONIC_USERNAME"); _password = Environment.GetEnvironmentVariable("AUPHONIC_PASSWORD"); _accessToken = Environment.GetEnvironmentVariable("AUPHONIC_ACCESS_TOKEN"); _productionFilePath = Environment.GetEnvironmentVariable("AUPHONIC_PRODUCTION_FILE_PATH"); _logFilePath = Environment.GetEnvironmentVariable("AUPHONIC_LOG_FILE_PATH"); _hasClientCredentials = !String.IsNullOrWhiteSpace(_clientId) && !String.IsNullOrWhiteSpace(_clientSecret); _hasUserCredentials = !String.IsNullOrWhiteSpace(_username) && !String.IsNullOrWhiteSpace(_password); _hasAccessToken = !String.IsNullOrWhiteSpace(_accessToken); if (_hasClientCredentials) { _auphonic = new Auphonic(_clientId, _clientSecret); if (_hasAccessToken) { _auphonic.Authenticate(_accessToken); if (!String.IsNullOrWhiteSpace(_logFilePath)) { _auphonic.RecieveResponse += Auphonic_RecieveResponse; _auphonic.SendRequest += Auphonic_SendRequest; } } } }
public void Initialize_Constructor_With_Valid_Parameters() { Auphonic auphonic = null; Assert.That(() => auphonic = new Auphonic(ClientId, ClientSecret), Throws.Nothing); Assert.That(auphonic.ClientId, Is.EqualTo(ClientId)); Assert.That(auphonic.ClientSecret, Is.EqualTo(ClientSecret)); }
public void Invoke_Authenticate_With_Invalid_Client_Credentials_Throws_AuthenticationException() { HasUserCredentials(); var auphonic = new Auphonic("clientId", "clientSecret"); Assert.That(() => auphonic.Authenticate(_username, _password), Throws .InstanceOf <AuthenticationException>() .And.Property("Message").EqualTo("invalid_client: client_id clientId doesn't exist")); }
public void Invoke_Authenticate_With_Invalid_User_Credentials_Throws_AuthenticationException() { HasClientCredentials(); var auphonic = new Auphonic(_clientId, _clientSecret); Assert.That(() => auphonic.Authenticate("username", "password"), Throws .InstanceOf <AuthenticationException>() .And.Property("Message").EqualTo("invalid_request: User authentication failed.")); }
public void Invoke_Authenticate_With_Invalid_Token_Throws_AuthenticationException() { HasClientCredentials(); var auphonic = new Auphonic(_clientId, _clientSecret); auphonic.Authenticate("24p5w92x9a"); Assert.That(() => auphonic.GetAccountInfo(), Throws .InstanceOf <AuthenticationException>() .And.Property("Message").EqualTo("Token doesn't exist")); }
public void OneTimeSetUp() { _clientId = Environment.GetEnvironmentVariable("AUPHONIC_CLIENT_ID"); _clientSecret = Environment.GetEnvironmentVariable("AUPHONIC_CLIENT_SECRET"); _hasClientCredentials = !String.IsNullOrWhiteSpace(_clientId) && !String.IsNullOrWhiteSpace(_clientSecret); if (_hasClientCredentials) { _auphonic = new Auphonic(_clientId, _clientSecret); } }
public void SetUp() { _auphonicService = new AuphonicService(Client); _auphonic = new Auphonic(ClientId, ClientSecret, _auphonicService); }