Tests/Get-OriAzBopVersionParamHelper.tests.ps1

. $PSScriptRoot\..\Private\Get-OriAzBopVersionParamHelper.ps1

Describe 'OriAzBopBoostrapOriPsgallery\Get-OriAzBopVersionParamHelper' {
    
    Context 'Succesfull excution' {    

        Mock -CommandName Write-Verbose -Verifiable

        it 'Should be succesfully processed when reference is only type of string' {
            {
                $ActualResult = Get-OriAzBopVersionParamHelper -Module 'ModuleA'                
                $ExpectedReturn = @{
                    Name = 'ModuleA'
                }

                [String]::Compare($ActualResult, $ExpectedReturn) | Should -BeExactly 0

            } | Should -Not -Throw
        }      
      
        Assert-MockCalled Write-Verbose -Times 1 -Exactly -ParameterFilter {
            $Message -eq "-- End of Get-OriAzBopVersionParamHelper --"
        }
       
        Assert-VerifiableMock
  
    }
    Context 'Succesfull excution' {    

        Mock -CommandName Write-Verbose -Verifiable

        it 'Should be succesfully processed when reference is only type of Module' {
            {
                $ActualResult = Get-OriAzBopVersionParamHelper -Module @{
                    ModuleName      = 'ModuleB'
                    Guid            = 123
                    MaximumVersion  = '1.0.10'
                    ModuleVersion   = '1.0.3'
                    Version         = '1.0.2'
                    PreRelease      = 'pre06'
                    AllowPrerelease = '1'
                }              
                $ExpectedReturn = @{
                    Name            = 'ModuleB'
                    Guid            = 123
                    MaximumVersion  = '1.0.10'
                    RequiredVersion = '1.0.3'
                    Version         = '1.0.2'
                    PreRelease      = 'pre06'
                    AllowPrerelease = '1'
                }

                [String]::Compare($ActualResult, $ExpectedReturn) | Should -BeExactly 0

            } | Should -Not -Throw
        }      
      
        Assert-MockCalled Write-Verbose -Times 1 -Exactly -ParameterFilter {
            $Message -eq "-- End of Get-OriAzBopVersionParamHelper --"
        }
       
        Assert-VerifiableMock
  
    }

}