/**
  * @covers WindowsAzure\Common\Internal\OAuthRestProxy::getAccessToken
  * @covers WindowsAzure\Common\Internal\OAuthRestProxy::__construct
  */
 public function testGetAccessToken()
 {
     // Setup
     $channel = new HttpClient();
     $uri = Resources::MEDIA_SERVICES_OAUTH_URL;
     $connection = TestResources::getMediaServicesConnectionParameters();
     $settings = new MediaServicesSettings($connection['accountName'], $connection['accessKey']);
     $scope = Resources::MEDIA_SERVICES_OAUTH_SCOPE;
     // Test
     $proxy = new OAuthRestProxy($channel, $uri);
     $actual = $proxy->getAccessToken(Resources::OAUTH_GT_CLIENT_CREDENTIALS, $settings->getAccountName(), $settings->getAccessKey(), $scope);
     // Assert
     $this->assertNotNull($proxy);
     $this->assertNotNull($actual->getAccessToken());
     $this->assertGreaterThan(time(), $actual->getExpiresIn());
     $this->assertEquals($scope, $actual->getScope());
 }
 /**
  * @covers WindowsAzure\Common\Internal\Authentication\OAuthScheme::getAuthorizationHeader
  */
 public function testGetAuthorizationHeaderMultiple()
 {
     $this->skipIfEmulated();
     // Setup
     // OAuth REST setup
     $channel = new HttpClient();
     $uri = Resources::MEDIA_SERVICES_OAUTH_URL;
     $connection = TestResources::getMediaServicesConnectionParameters();
     $settings = new MediaServicesSettings($connection['accountName'], $connection['accessKey']);
     $scope = Resources::MEDIA_SERVICES_OAUTH_SCOPE;
     $grantType = Resources::OAUTH_GT_CLIENT_CREDENTIALS;
     $rest = new OAuthRestProxy($channel, $uri);
     // Scheme setup
     $headers = array();
     $url = Resources::MEDIA_SERVICES_URL;
     $queryParams = array();
     $httpMethod = Resources::HTTP_GET;
     // Get access token
     $scheme = new OAuthScheme($settings->getAccountName(), $settings->getAccessKey(), $grantType, $scope, $rest);
     $token = $scheme->getAuthorizationHeader($headers, $url, $queryParams, $httpMethod);
     // Test
     $actual = $scheme->getAuthorizationHeader($headers, $url, $queryParams, $httpMethod);
     // Assert
     $this->assertEquals($token, $actual);
 }
 /**
  * @covers WindowsAzure\Common\Internal\MediaServicesSettings::getOAuthEndpointUri
  */
 public function testGetOAuthEndpointUri()
 {
     // Setup
     $data = 'http://test.com';
     // Test
     $settings = new MediaServicesSettings('test', 'test', null, $data);
     // Assert
     $this->assertEquals($data, $settings->getOAuthEndpointUri());
 }