Tests/Get-AppService.Tests.ps1
$projectRoot = Split-Path -Path $PSScriptRoot; . "$projectRoot\_functionReference.ps1"; Describe "Get-AppService" { $certsList = New-Object -TypeName System.Collections.ArrayList; $cert1 = [PsCustomObject]@{ Thumbprint = "ABCD23432223ACBD"; SubjectName = "some name"; HostNames = "www.host.com, subdom.host.com"; IssueDate = Get-Date; ExpirationDate = Get-Date; } $certsList.Add($cert1); $resourceGroupName = "testResource"; #mock services Mock -CommandName Get-AzureRmWebAppCertificate { return $certsList }; Mock -CommandName Add-Log -MockWith {}; Mock -CommandName Out-Error -MockWith {}; Mock -CommandName Set-Output -MockWith {}; Context "Retrieves all certificates for a given resource group name"{ Get-AppService It "Call the app service certificate service with the correct resource group name" { Assert-MockCalled -CommandName Get-AzureRmWebAppCertificate -ParameterFilter { $ResourceGroupName -eq $resourceGroupName } -Times 1 -Exactly } It "Sends acquired data to the output pipeline" { Assert-MockCalled -CommandName Set-Output -Times 1 -Exactly } } } |