Added mock write-host to clean up output.

Added the general creation of the $object needed to mock the function.
This commit is contained in:
Conor Tolan
2019-02-23 16:37:03 +00:00
parent 3a61850b41
commit 6c578f7b78
2 changed files with 5 additions and 1 deletions

View File

@@ -22,6 +22,8 @@ Describe "$functionName" -Tag 'Unit' {
return $object
}
Mock Write-host {}
Mock Connect-VIServer {}
Mock Connect-CisServer {}

View File

@@ -21,8 +21,9 @@ Describe "$functionName" -Tag 'Unit' {
"user_name" = $user_name
"id" = $id
}
#$object | Add-Member -MemberType ScriptMethod -Name "list" -Value { $MockedList }
$object = [PSCustomObject]@{}
$object | Add-Member -MemberType ScriptMethod -Name "list" -Value { $MockedList }
$MockedArray = @()
$MockedArray += $MockedList
@@ -37,6 +38,7 @@ Describe "$functionName" -Tag 'Unit' {
}
Context "Behavior testing" {
It "calls get-service to com.vmware.vmc.orgs" {
{ Get-VMCOrg -name $OrgName } | Should Not Throw
Assert-MockCalled -CommandName Get-VMCService -Times 1 -Scope It -ParameterFilter { $name -eq $Service }