AzureRM.Bootstrapper.ScenarioTests.ps1

Import-Module -Name AzureRM.Bootstrapper
$RollupModule = 'AzureRM'
InModuleScope AzureRM.Bootstrapper {
    $ProfileMap = (Get-AzProfile)
    $ProfileCachePath = Get-ProfileCachePath

    # Helper function to uninstall all profiles
    function Remove-InstalledProfile {
        $installedProfiles = Get-ProfilesInstalled -ProfileMap $ProfileMap
        if ($installedProfiles.Keys -ne $null)
        {
            foreach ($profile in $installedProfiles.Keys)
            {
                Write-Host "Removing profile $profile"
                Uninstall-AzureRmProfile -Profile $profile -Force -ErrorAction SilentlyContinue
            }
            
            $profiles = (Get-ProfilesInstalled -ProfileMap $ProfileMap)
            if ($profiles.Count -ne 0)
            {
                Throw "Uninstallation was not successful: Profile(s) $(@($profiles.Keys) -join ',') were not uninstalled correctly."
            }
        }
    }

    Describe "A machine with no profile installed can install profile" {

        # Using Install-AzureRmProfile
        Context "New Profile Install - Latest" {
            # Arrange
            # Uninstall previously installed profiles
            Remove-InstalledProfile       

            # Launch the test in a new powershell session
            # Create a new PS session
            $session = New-PSSession

            # Act
            # Install latest version
            Invoke-Command -Session $session -ScriptBlock { Install-AzureRmProfile -Profile 'Latest' -Force } 

            # Assert
            It "Should return Latest Profile" {
                $result = Invoke-Command -Session $session -ScriptBlock { Get-AzureRmProfile } 
                $result[0].Contains('Latest') | Should Be $true
            }

            # Clean up
            Remove-PSSession -Session $session
        } 

        # Using Use-AzureRmProfile
        Context "New Profile Install - 2016-04-consistent" {
            # Arrange
            # Uninstall previously installed profiles
            Remove-InstalledProfile

            # Create a new PS session
            $session = New-PSSession

            # Act
            # Install profile '2016-04-consistent'
            Invoke-Command -Session $session -ScriptBlock { Use-AzureRmProfile -Profile '2016-04-consistent' -Force }

            # Assert
            It "Should return 2016-04-consistent" {
                $result = Invoke-Command -Session $session -ScriptBlock { Get-AzureRmProfile } 
                $result[0].Contains('2016-04-consistent') | Should Be $true
            }

            # Clean up
            Remove-PSSession -Session $session
        }
    }

    Describe "Add: A Machine with a Profile installed can install latest profile" {
        InModuleScope AzureRM.Bootstrapper {

            Context "Profile 2016-04-consistent already installed" {
                # Arrange
                # Create a new PS session
                $session = New-PSSession

                # Ensure 2016-09-consistent is installed
                $profilesInstalled = Invoke-Command -Session $session -ScriptBlock { Get-AzureRmProfile } 
                $profilesInstalled[0].Contains('2016-04-consistent') | Should Be $true

                # Act
                # Install profile 'Latest'
                Invoke-Command -Session $session -ScriptBlock { Use-AzureRmProfile -Profile 'Latest' -Force }
                $result = Invoke-Command -Session $session -ScriptBlock { Get-AzureRmProfile }

                # Assert
                It "Should return 2016-09-consistent & Latest" {
                    ($result -like "*latest*") -ne $null | Should Be $true 
                    ($result -like "*2016-04-consistent*") -ne $null | Should Be $true
                }

                # Clean up
                Remove-PSSession -Session $session
            }
        }
    }

    Describe "Attempting to use already installed profile will import the modules to the current session" {
        InModuleScope AzureRM.Bootstrapper {
            Context "Profile Latest is installed" {
                # Should import Latest profile to current session
                # Arrange
                # Create a new PS session
                $session = New-PSSession

                # Ensure profile Latest is installed
                $profilesInstalled = Invoke-Command -Session $session -ScriptBlock { Get-AzureRmProfile } 
                ($profilesInstalled -like "*latest*") -ne $null | Should Be $true

                # Act
                Invoke-Command -Session $session -ScriptBlock { Use-AzureRmProfile -Profile 'Latest' -Force }

                # Get the version of the Latest profile
                $ProfileMap = Get-AzProfile
                $latestVersion = $ProfileMap.'Latest'.$RollupModule

                # Assert
                It "Should return AzureRm module Latest version" {
                    # Get-module script block
                    $getModule = {
                        Param($RollupModule)
                        Get-Module -Name $RollupModule 
                    }

                    $modules = Invoke-Command -Session $session -ScriptBlock $getModule -ArgumentList $RollupModule
                
                    $modules.Name | Should Be $RollupModule
                    $modules.version | Should Be $latestVersion
                }

                # Cleanup
                Invoke-Command -Session $session -ScriptBlock { Uninstall-AzureRmProfile -Profile 'Latest' -Force -ea SilentlyContinue }
                Remove-PSSession -Session $session
            }
        }
    }

    Describe "User can update their machine to a latest profile" {
        InModuleScope AzureRM.Bootstrapper {
            # Using Use-AzureRmProfile
            Context "Profile 2016-09-consistent is installed: Use-AzureRmProfile" {
                # Should refresh profile map from Azure end point and update modules.
                # Arrange
                # Create a new PS session
                $session = New-PSSession

                # Check if '2016-04-consistent' is installed
                $profilesInstalled = Invoke-Command -Session $session -ScriptBlock { Get-AzureRmProfile } 
                ($profilesInstalled -like "*2016-04-consistent*") -ne $null | Should Be $true

                # Remove latest profile map from cache for testing if it updates from online.
                $latestMap = Get-LatestProfileMapPath
                if (($latestMap -ne $null) -and (Test-Path $latestMap.FullName))
                {
                    Remove-Item -Path $latestMap.FullName -Force
                }
                
                # Act
                Invoke-Command -Session $session -ScriptBlock { Get-AzureRmProfile -Update }
                Invoke-Command -Session $session -ScriptBlock { Use-AzureRmProfile -Profile 'Latest' -Force }
        
                # Assert
                It "Should return 2016-04-consistent & Latest" {
                    $result = Invoke-Command -Session $session -ScriptBlock { Get-AzureRmProfile }
                    ($result -like "*latest*") -ne $null | Should Be $true 
                    ($result -like "*2016-04-consistent*") -ne $null | Should Be $true
                }

                It "Latest version of modules are imported" {
                    # Get the version of the Latest profile
                    $ProfileMap = Get-AzProfile
                    $latestVersion = $ProfileMap.'Latest'.$RollupModule
                
                    # Get-module script block
                    $getModule = {
                        Param($RollupModule)
                        Get-Module -Name $RollupModule 
                    }

                    $modules = Invoke-Command -Session $session -ScriptBlock $getModule -ArgumentList $RollupModule
                
                    # Are latest modules imported?
                    $modules.Name | Should Be $RollupModule
                    $modules.version | Should Be $latestVersion
                }
            
                It "Last Write Time should be less than 5 minutes" {
                    # Get LastWriteTime for ProfileMap
                    $lastWriteTime = (Get-Item -Path (Get-LatestProfileMapPath).FullName).LastWriteTime
                    (((Get-Date) - $lastWriteTime).TotalMinutes -lt 5) | Should Be $true
                }

                # Cleanup
                Remove-PSSession -Session $session
            }
        
            # Using Update-AzureRmProfile; Previous Versions do not exist
            Context "Profile 2016-04-consistent is installed: Update-AzureRmProfile" {
                # Arrange
                # Remove existing profiles
                Remove-InstalledProfile

                # Create a new PS session
                $session = New-PSSession

                # Install profile 2016-04-consistent
                Install-AzureRmProfile -Profile '2016-04-consistent' -Force

                # Ensure profile 2016-04-consistent is installed
                $profilesInstalled = Invoke-Command -Session $session -ScriptBlock { Get-AzureRmProfile } 
                ($profilesInstalled -like "*2016-04-consistent*") -ne $null | Should Be $true

                # Act
                # Update to profile 'Latest'
                Invoke-Command -Session $session -ScriptBlock { Update-AzureRmProfile -Profile 'Latest' -Force -RemovePreviousVersions }

                # Assert
                # Returns 2016-04-consistent & Latest
                It "Should Return 2016-04-consistent & Latest" {
                    $result = Invoke-Command -Session $session -ScriptBlock { Get-AzureRmProfile }
                    ($result -like "*latest*") -ne $null | Should Be $true 
                    ($result -like "*2016-04-consistent*") -ne $null | Should Be $true
                }

                It "Latest version of modules are imported" {
                    # Get the version of the Latest profile
                    $ProfileMap = Get-AzProfile
                    $latestVersion = $ProfileMap.'Latest'.$RollupModule
                
                    # Get-module script block
                    $getModule = {
                        Param($RollupModule)
                        Get-Module -Name $RollupModule 
                    }

                    $modules = Invoke-Command -Session $session -ScriptBlock $getModule -ArgumentList $RollupModule
                
                    # Are latest modules imported?
                    $modules.Name | Should Be $RollupModule
                    $modules.version | Should Be $latestVersion
                }

                Remove-PSSession -Session $session
            }
            
            # Using Update-AzureRmProfile; Previous Versions exist
            Context "Profile 2016-04-consistent is installed: Update-AzureRmProfile with PreviousVerisons" {
                # Arrange
                # Remove existing profiles
                Remove-InstalledProfile
    
                # Create a new PS session
                $session = New-PSSession

                # Install profile 2016-04-consistent
                Install-AzureRmProfile -Profile '2016-04-consistent' -Force

                # Ensure profile 2016-04-consistent is installed
                $profilesInstalled = Invoke-Command -Session $session -ScriptBlock { Get-AzureRmProfile } 
                ($profilesInstalled -like "*2016-04-consistent*") -ne $null | Should Be $true

                # Remove latest profile map from cache for testing if it updates from online.
                $latestMap = Get-LatestProfileMapPath
                if (($latestMap -ne $null) -and (Test-Path $latestMap.FullName))
                {
                    Remove-Item -Path $latestMap.FullName -Force
                }

                # Add a version of old profilemap with older versions of 'latest' profile to cache
                $testProfileMap = "{`"Latest`": { `"AzureRM`": [`"3.3.0`"], `"Azure.Storage`": [`"2.4.0`"] }}" 
                $testProfileMap | Out-File -FilePath "$ProfileCachePath\TestMap.json" -Force

                # Install the modules from that profilemap
                $testProfileMap = ($testProfileMap | ConvertFrom-Json)
                
                foreach ($Module in ($testProfileMap.'Latest' | Get-Member -MemberType NoteProperty).Name)
                {
                    $oldVersion = $testProfileMap.'Latest'.$Module
                    Install-Module $Module -RequiredVersion $oldVersion[0] -ErrorAction Stop -AllowClobber
                }

                # Act
                # Invoke Update-AzureRmProfile 'latest' with -RemovePreviousVersions
                Invoke-Command -Session $session -ScriptBlock { Get-AzureRmProfile -update }
                Invoke-Command -Session $session -ScriptBlock { Update-AzureRmProfile -Profile 'Latest' -Force -RemovePreviousVersions }

                # Assert
                # Check if new versions of 'latest' are installed
                $latestVersion = $ProfileMap.'Latest'.$RollupModule

                It "Should return latest module versions" {
                    # Get-module script block
                    $getModule = {
                        Param($RollupModule)
                        Get-AzureRmModule -Profile 'Latest' -Module $RollupModule 
                    }
                
                    $version = Invoke-Command -Session $session -ScriptBlock $getModule -ArgumentList $RollupModule
                    $version | Should Be $latestVersion
                }

                # Check if old versions of 'latest' are uninstalled
                It "Should return null for old versions" {
                    # Get-module script block
                    $getModule = {
                        Param($RollupModule)
                        Get-Module -Name $RollupModule -ListAvailable
                    }

                    $modules = Invoke-Command -Session $session -ScriptBlock $getModule -ArgumentList $RollupModule
                    foreach ($module in $modules)
                    {
                        $module.Version -eq $oldVersion | Should Be $false
                    }
                }

                # Check if the old profilemap was removed
                It "Should return false for old profile map in cache" {
                    (Test-Path "$ProfileCachePath\TestMap.json") | Should Be $false
                }
            }
        }
    }

    Describe "User can uninstall a profile" {
        InModuleScope AzureRM.Bootstrapper {
            Context "Latest profile is installed" {
                # Should uninstall latest profile
                # Arrange
                # Create a new PS session
                $session = New-PSSession

                # Check if 'Latest' is installed
                $profilesInstalled = Invoke-Command -Session $session -ScriptBlock { Get-AzureRmProfile } 
                ($profilesInstalled -like "*latest*") -ne $null | Should Be $true

                # Get the version of the Latest profile
                $ProfileMap = Get-AzProfile
                $latestVersion = $ProfileMap.'Latest'.$RollupModule

                # Act
                Invoke-Command -Session $session -ScriptBlock { Uninstall-AzureRmProfile -Profile 'Latest' -Force }
            
                # Assert
                It "Profile Latest is uninstalled" {
                    $result = Invoke-Command -Session $session -ScriptBlock { Get-AzureRmProfile }
                    if($result -ne $null)
                    {
                        $result.Contains('Latest') | Should Be $false
                    }
                    else {
                        $true
                    }
                }

                It "Available Modules should not contain uninstalled modules" {
                    $getModule = {
                        Param($RollupModule)
                        Get-Module -Name $RollupModule -ListAvailable
                    }
                    $results = Invoke-Command -Session $session -ScriptBlock $getModule -ArgumentList $RollupModule
                    
                    # Result won't be null because profile 2016-04-consistent is installed.
                    foreach ($result in $results)
                    {
                        $result.Version -eq $latestVersion | Should Be $false
                    }
                        
                }

                # Cleanup
                Remove-PSSession -Session $session
            }
        }
    }

    Describe "Install Two named profiles and selecting each" {
        InModuleScope AzureRM.Bootstrapper {
            # Get the version of the respective profile
            $ProfileMap = Get-AzProfile
            $Version1 = $ProfileMap.'Latest'.$RollupModule
            $Version2 = $ProfileMap.'2016-04-consistent'.$RollupModule

            Context "Install Two Profiles" {
                # Arrange
                # Remove all profiles
                Remove-InstalledProfile

                # Create a new PS session
                $session = New-PSSession

                # Act
                # Install Profile: 2016-08
                Invoke-Command -Session $session -ScriptBlock { Install-AzureRmProfile -Profile 'Latest' -Force } 

                # Install Profile: 2016-04
                Invoke-Command -Session $session -ScriptBlock { Install-AzureRmProfile -Profile '2016-04-consistent' -Force } 

                # Assert
                It "Should return Profiles Latest & 2016-04-consistent" {
                $profilesInstalled = Invoke-Command -Session $session -ScriptBlock { Get-AzureRmProfile } 
                ($profilesInstalled -like "*2016-04-consistent*") -ne $null | Should Be $true
                ($profilesInstalled -like "*latest*") -ne $null | Should Be $true
            }

                # Clean up
                Remove-PSSession -Session $session        
            }

            Context "Select diff profiles" {
                # Arrange
                # Create two new PS sessions
                $session1 = New-PSSession
                $session2 = New-PSSession

                # Act
                # Use-AzureRmProfile will import the respective versions of modules in the session
                Invoke-Command -Session $session1 -ScriptBlock { Use-AzureRmProfile -Profile 'Latest' -Force }
                Invoke-Command -Session $session2 -ScriptBlock { Use-AzureRmProfile -Profile '2016-04-consistent' -Force } 
    
                $getModule = {
                    Param($RollupModule)
                    Get-Module -Name $RollupModule
                }

                $result = Invoke-Command -Session $session1 -ScriptBlock { Get-AzureRmProfile }
                $module1 = Invoke-Command -Session $session1 -ScriptBlock $getModule -ArgumentList $RollupModule
                $module2 = Invoke-Command -Session $session2 -ScriptBlock $getModule -ArgumentList $RollupModule

                # Assert
                It "Should return Latest & 2016-04-consistent" {
                    ($result -like "*latest*") -ne $null | Should Be $true 
                    ($result -like "*2016-04-consistent*") -ne $null | Should Be $true
                }

                It "Respective versions of modules are imported" {
                    # Are respective modules imported?
                    $module1.Name | Should Be $RollupModule
                    $module1.version | Should Be $Version1

                    $module2.Name | Should Be $RollupModule
                    $module2.version | Should Be $Version2
                }

                # "Uninstall All Profiles"
                Remove-InstalledProfile

                It "Should return null" {
                    Get-AzureRmProfile | Should Be $null
                }

                It "Modules should return null" {
                    $getModuleList = {
                        Param($RollupModule)
                        Get-Module -ListAvailable -Name $RollupModule
                    }

                    $result1 = Invoke-Command -Session $session1 -ScriptBlock $getModuleList  -ArgumentList $RollupModule
                    foreach ($result in $result1)
                    {
                        $result.Version -eq $Version1 | Should Be $false
                    }
                    $result2 = Invoke-Command -Session $session2 -ScriptBlock $getModuleList  -ArgumentList $RollupModule
                    foreach ($result in $result2)
                    {
                        $result.Version -eq $Version2 | Should Be $false
                    }
                }

                # Cleanup
                Remove-PSSession -Session $session1
                Remove-PSSession -Session $session2
            }
        }
    }

    Describe "Invalid Cases" {
        Context "Install wrong profile name" {
            # Install profile 'abcTest'
            It "Throws Invalid argument error" {
                { Install-AzureRmProfile -Profile 'abcTest' } | Should Throw
            }
        }

        Context "Install null profile name" {
            # Install profile 'null'
            It "Throws Invalid argument error" {
                { Install-AzureRmProfile -Profile $null } | Should Throw
            }
        }

        Context "Install already installed profile" {
            # Arrange
            # Create a new PS session
            $session = New-PSSession

            # Ensure profile 2016-09 is installed
            Install-AzureRmProfile -Profile '2016-04-consistent' -Force
            $installedProfile = Invoke-Command -Session $session -ScriptBlock { Get-AzureRmProfile }
            ($installedProfile -like "*2016-04-consistent*") -ne $null | Should Be $true
            
            # Act
            # Install profile '2016-04-consistent'
            $result = Invoke-Command -Session $session -ScriptBlock { Install-AzureRmProfile -Profile '2016-04-consistent' -Force } 

            # Get modules imported into the session
            $getModuleList = {
                    Param($RollupModule)
                    Get-Module -Name $RollupModule
                }
            $modules = Invoke-Command -Session $session -ScriptBlock $getModuleList  -ArgumentList $RollupModule

            It "Doesn't install/import the profile" {
                $result | Should Be $null
                $modules | Should Be $null
            }

            # Cleanup
            Remove-PSSession -Session $session
        }

        Context "Uninstall not installed profile" {
            # Arrange
            # Create a new PS session
            $session = New-PSSession

            # Ensure profile latest is not installed
            $installedProfile = Invoke-Command -Session $session -ScriptBlock { Get-AzureRmProfile }
            ($installedProfile -like "*latest*") | Should Be $null

            # Act
            # Uninstall profile 'latest'
            $result = Invoke-Command -Session $session -ScriptBlock { Uninstall-AzureRmProfile -Profile 'latest' -Force} 

            It "Doesn't uninstall/throw" {
                $result | Should Be $null
            }

            # Cleanup
            Remove-PSSession -Session $session
        }

        Context "Use-AzureRmProfile with wrong profile name" {
            # Install profile 'abcTest'
            It "Throws Invalid argument error" {
                { Use-AzureRmProfile -Profile 'abcTest' } | Should Throw
            }
        }
    }

    Describe "Failure Recovery: Attempt to install profile recovers from error" {
        InModuleScope AzureRM.Bootstrapper {
            Context "Azure ProfileMap endpoint threw exception" {
                # Arrange
                # Mock Get-ProfileMap returns error
                Mock Get-AzureProfileMap -Verifiable { throw [System.Net.WebException] }
            
                # Mock Install-Modules returns error
                Mock Install-Module -Verifiable { throw }
                Mock Get-AzureRmModule -Verifiable {}

                # Act & Assert
                It "Should not download/install the latest profile" {
                    { Get-AzureRmProfile -Update } | Should Throw
                    { Install-AzureRmProfile -Profile 'Latest' -Force } | Should Throw
                }

                It "Last Write time should not be less than 3 mins" {
                    # Get LastWriteTime for ProfileMap
                    $lastWriteTime = (Get-Item -Path (Get-LatestProfileMapPath).FullName).LastWriteTime
                    (((Get-Date) - $lastWriteTime).TotalMinutes -gt 3) | Should Be $true
                    Assert-VerifiableMock
                }
            }

            Context "Retry install after ProfileMap update" {
                # Arrange
                # Create a new PS session
                $session = New-PSSession

                # Remove ProfileMap.json to test if it is updated from online
                Remove-Item -Path (Get-LatestProfileMapPath).FullName -Force

                # Act
                # Update ProfileMap
                Invoke-Command -Session $session -ScriptBlock { Get-AzureRmProfile -Update }

                # Install profile 'Latest'
                Invoke-Command -Session $session -ScriptBlock { Use-AzureRmProfile -Profile 'Latest' -Force } 

                # Assert
                It "Installs & Imports Latest profile to the session" {
                    $getModuleList = {
                        Param($RollupModule)
                        Get-Module -Name $RollupModule
                    }
                    $modules = Invoke-Command -Session $session -ScriptBlock $getModuleList  -ArgumentList $RollupModule

                    # Get the version of the Latest profile
                    $ProfileMap = Get-AzProfile
                    $latestVersion = $ProfileMap.'Latest'.$RollupModule
                
                    # Are latest modules imported?
                    $modules.Name | Should Be $RollupModule
                    $modules.version | Should Be $latestVersion
                }

                It "Last Write time should be less than 5 mins" {
                    # Get LastWriteTime for ProfileMap
                    $lastWriteTime = (Get-Item -Path (Get-LatestProfileMapPath).FullName).LastWriteTime
                    (((Get-Date) - $lastWriteTime).TotalMinutes -lt 5) | Should Be $true
                }

                # Cleanup
                Remove-PSSession -Session $session
            }
        }
    }

    Describe "Install profiles using Scope" {
        InModuleScope AzureRM.Bootstrapper {

            Context "Using Install-AzureRmProfile: Scope 'CurrentUser'" {
                # Arrange
                # Create a new PS session
                $session = New-PSSession

                # Remove installed profiles
                Remove-InstalledProfile 

                # Act
                # Install profile Latest scope as current user
                Invoke-Command -Session $session -ScriptBlock { Install-AzureRmProfile -Profile 'Latest' -scope 'CurrentUser' -Force }

                # Assert
                It "Installs & Imports Latest profile to the session" {
                    # Get the version of the Latest profile
                    $ProfileMap = Get-AzProfile
                    $latestVersion = $ProfileMap.'Latest'.$RollupModule
                    
                    $getModuleList = {
                        Param($RollupModule, $latestVersion)
                        Get-Module -Name $RollupModule -ListAvailable | Where-Object {$_.Version -like $latestVersion}
                    }
                    $modules = Invoke-Command -Session $session -ScriptBlock $getModuleList  -ArgumentList @($RollupModule, $latestVersion)

                    # Are latest modules imported?
                    $modules.Name | Should Be $RollupModule
                    $modules.version | Should Be $latestVersion
                }
            }

            Context "Using Use-AzureRmProfile: Scope 'AllUsers'" {
                # Arrange
                # Create a new PS session
                $session = New-PSSession

                # Remove installed profiles
                Remove-InstalledProfile 

                # Act
                # Install profile 2016-04-consistent scope as all users
                Invoke-Command -Session $session -ScriptBlock { Use-AzureRmProfile -Profile '2016-04-consistent' -scope 'AllUsers' -Force }

                # Assert
                It "Installs & Imports 2016-04-consistent profile to the session" {
                    $getModuleList = {
                        Param($RollupModule)
                        Get-Module -Name $RollupModule
                    }
                    $modules = Invoke-Command -Session $session -ScriptBlock $getModuleList  -ArgumentList $RollupModule

                    # Get the version of the 2016-04-consistent profile
                    $ProfileMap = Get-AzProfile
                    $version = $ProfileMap.'2016-04-consistent'.$RollupModule
                
                    # Are appropriate modules imported?
                    $modules.Name | Should Be $RollupModule
                    $modules.version | Should Be $version
                }
            }

            Context "Using Update-AzureRmProfile: Scope 'CurrentUser' " {
                # Arrange
                # Create a new PS session
                $session = New-PSSession

                # Remove installed profiles
                Remove-InstalledProfile 

                # Act
                # Install profile 2016-04-consistent scope as current user
                Invoke-Command -Session $session -ScriptBlock { Update-AzureRmProfile -Profile '2016-04-consistent' -scope 'CurrentUser' -Force -r }

                # Assert
                It "Installs & Imports 2016-04-consistent profile to the session" {
                    $getModuleList = {
                        Param($RollupModule)
                        Get-Module -Name $RollupModule
                    }
                    $modules = Invoke-Command -Session $session -ScriptBlock $getModuleList  -ArgumentList $RollupModule

                    # Get the version of the 2016-04-consistent profile
                    $ProfileMap = Get-AzProfile
                    $version = $ProfileMap.'2016-04-consistent'.$RollupModule
                
                    # Are correct modules imported?
                    $modules.Name | Should Be $RollupModule
                    $modules.version | Should Be $version
                }
            }
        }
    }

    Describe "Load/Import AzureRmProfile modules" {
        InModuleScope AzureRM.Bootstrapper {
        Context "Using Use-AzureRmProfile: Modules are not installed" {
                # Arrange
                # Create a new PS session
                $session = New-PSSession

                # Remove installed profiles
                Remove-InstalledProfile 

                # Act
                # Use module from Latest profile scope as current user
                Invoke-Command -Session $session -ScriptBlock { Use-AzureRmProfile -Profile '2016-04-consistent' -Module 'AzureRM.Storage' -Force -scope 'CurrentUser'}

                # Assert
                $RollupModule = 'AzureRM.Storage'
                It "Installs & Imports 2016-04-consistent profile's module to the session" {
                    $getModuleList = {
                        Param($RollupModule)
                        Get-Module -Name $RollupModule
                    }
                    $modules = Invoke-Command -Session $session -ScriptBlock $getModuleList  -ArgumentList $RollupModule

                    # Get the version of the 2016-04-consistent profile
                    $ProfileMap = Get-AzProfile
                    $version = $ProfileMap.'2016-04-consistent'.$RollupModule
                
                    # Are 2016-04-consistent modules imported?
                    $modules.Name | Should Be $RollupModule
                    $modules.version | Should Be $version
                }
            }

            Context "Using Update-AzureRmProfile: Previous version of modules are installed" {
                # Arrange
                # Create a new PS session
                $session = New-PSSession

                # Remove installed profiles
                Remove-InstalledProfile 

                # Remove latest profile map from cache for testing if it updates from online.
                $latestMap = Get-LatestProfileMapPath
                if (($latestMap -ne $null) -and (Test-Path $latestMap.FullName))
                {
                    Remove-Item -Path $latestMap.FullName -Force
                }

                # Add a version of old profilemap with older versions of 'latest' profile to cache
                $testProfileMap = "{`"Latest`": {`"Azure.Storage`": [`"2.4.0`"], `"AzureRM.Storage`": [`"2.4.0`"] }}" 
                $testProfileMap | Out-File -FilePath "$ProfileCachePath\TestMap.json" -Force

                # Install the modules from that profilemap
                $testProfileMap = ($testProfileMap | ConvertFrom-Json)
                
                foreach ($Module in ($testProfileMap.'Latest' | Get-Member -MemberType NoteProperty).Name)
                {
                    $oldVersion = $testProfileMap.'Latest'.$Module
                    Install-Module $Module -RequiredVersion $oldVersion[0] -ErrorAction Stop -AllowClobber
                }

                # Act
                # Update profile Latest with -RemovePreviousVersions
                Invoke-Command -Session $session -ScriptBlock { Get-AzureRmProfile -Update }
                Invoke-Command -Session $session -ScriptBlock { Update-AzureRmProfile -Profile 'Latest' -Module 'AzureRM.Storage', 'Azure.Storage' -Force -r }

                # Assert
                It "Installs & Imports latest profile's module ('AzureRM.Storage') to the session" {
                    $getModuleList = {
                        Param($RollupModule)
                        Get-Module -Name $RollupModule
                    }
                    $module1 = Invoke-Command -Session $session -ScriptBlock $getModuleList  -ArgumentList 'AzureRM.Storage'

                    # Get the version of the latest profile
                    $ProfileMap = Get-AzProfile
                    $version1 = $ProfileMap.'Latest'.'AzureRM.Storage'
                    
                    # Are latest modules imported?
                    $module1.Name | Should Be 'AzureRM.Storage'
                    $module1.version | Should Be $version1
                }

                It "Installs & Imports latest profile's module ('Azure.Storage') to the session" {
                    $getModuleList = {
                        Param($RollupModule)
                        Get-Module -Name $RollupModule
                    }
                    $module2 = Invoke-Command -Session $session -ScriptBlock $getModuleList  -ArgumentList 'Azure.Storage'

                    # Get the version of the latest profile
                    $ProfileMap = Get-AzProfile
                    $version2 = $ProfileMap.'Latest'.'Azure.Storage'
                
                    # Are latest modules imported?
                    $module2.Name | Should Be 'Azure.Storage'
                    $module2.version | Should Be $version2
                }

                # Check if the old profilemap was removed
                It "Should return false for old profile map in cache" {
                    (Test-Path "$ProfileCachePath\TestMap.json") | Should Be $false
                }
            }
        }
    }
}
# SIG # Begin signature block
# MIIjkQYJKoZIhvcNAQcCoIIjgjCCI34CAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0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