functions/Export-RegentSolution.Tests.ps1
$here = Split-Path -Parent $MyInvocation.MyCommand.Path $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.Tests\.', '.' . "$here\$sut" Import-Module -Name Microsoft.Xrm.Data.Powershell Describe "Export-RegentSolution" { Context "Given a config file specifying repository path TestDrive:/solutions" { New-Item TestDrive:\solutions -ItemType Directory Mock 'Get-Config' { [PSCustomObject]@{ RepositoryPath = "TestDrive:\solutions"; DefaultBranch = "master"; } } It "should download the solution as both managed and unmanged, and export it to the path specified in the config" { $conn = Get-RegentConnection -CrmInstance CRMRECRUITTEST $results = Export-RegentSolution -SolutionName "RecordLocked" -conn $conn -Verbose $results[0].ExportSolutionResponse.GetType().Name | Should -Be "ExportSolutionResponse" $results[1].ExportSolutionResponse.GetType().Name | Should -Be "ExportSolutionResponse" Test-Path "TestDrive:/solutions/RecordLocked/" | Should -Be $true } } } |