/**
  * @covers WindowsAzure\ServiceRuntime\RoleEnvironment::isAvailable
  * @covers WindowsAzure\ServiceRuntime\RoleEnvironment::_initialize
  */
 public function testIsAvailable()
 {
     // Setup
     $rootDirectory = 'root';
     \vfsStreamWrapper::register();
     \vfsStreamWrapper::setRoot(new \vfsStreamDirectory($rootDirectory));
     $roleEnvironmentFileName = 'roleEnvironment';
     $roleEnvironmentFileContent = '<?xml version="1.0" encoding="utf-8"?>' . '<RoleEnvironment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' . 'xmlns:xsd="http://www.w3.org/2001/XMLSchema">' . '<Deployment id="id1" emulated="false" />' . '<CurrentInstance id="geophotoapp_IN_0" roleName="geophotoapp" faultDomain="0" updateDomain="0">' . '<ConfigurationSettings />' . '<LocalResources>' . '<LocalResource name="DiagnosticStore" path="somepath.DiagnosticStore" sizeInMB="4096" />' . '</LocalResources>' . '<Endpoints>' . '<Endpoint name="HttpIn" address="10.114.250.21" port="80" protocol="tcp" />' . '</Endpoints>' . '</CurrentInstance>' . '<Roles />' . '</RoleEnvironment>';
     $file = \vfsStream::newFile($roleEnvironmentFileName);
     $file->setContent($roleEnvironmentFileContent);
     \vfsStreamWrapper::getRoot()->addChild($file);
     $goalStateFileName = 'goalstate';
     $goalStateFileContent = '<?xml version="1.0" encoding="utf-8"?>' . '<GoalState xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' . 'xmlns:xsd="http://www.w3.org/2001/XMLSchema">' . '<Incarnation>1</Incarnation>' . '<ExpectedState>Started</ExpectedState>' . '<RoleEnvironmentPath>' . \vfsStream::url($rootDirectory . '/' . $roleEnvironmentFileName) . '</RoleEnvironmentPath>' . '<CurrentStateEndpoint>\\.\\pipe\\WindowsAzureRuntime.CurrentState</CurrentStateEndpoint>' . '<Deadline>9999-12-31T23:59:59.9999999</Deadline>' . '</GoalState>';
     $goalStateFileContent = dechex(strlen($goalStateFileContent)) . "\n" . $goalStateFileContent;
     $file = \vfsStream::newFile($goalStateFileName);
     $file->setContent($goalStateFileContent);
     \vfsStreamWrapper::getRoot()->addChild($file);
     $fileName = 'versionendpoint';
     $fileContent = '<?xml version="1.0" encoding="utf-8"?>' . '<RuntimeServerDiscovery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' . 'xmlns:xsd="http://www.w3.org/2001/XMLSchema">' . '<RuntimeServerEndpoints>' . '<RuntimeServerEndpoint version="2011-03-08" path="' . \vfsStream::url($rootDirectory . '/' . $goalStateFileName) . '" />' . '</RuntimeServerEndpoints>' . '</RuntimeServerDiscovery>';
     $file = \vfsStream::newFile($fileName);
     $file->setContent($fileContent);
     \vfsStreamWrapper::getRoot()->addChild($file);
     putenv('WaRuntimeEndpoint=' . \vfsStream::url($rootDirectory . '/' . $fileName));
     // Test
     $this->assertEquals(true, RoleEnvironment::isAvailable());
 }