Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
function ArchitestVolumeHaveSizeRemaining([Microsoft.Management.Infrastructure.CimInstance]$ActualValue, $ExpectedValue, [switch] $Negate)
{
$ActualValuePropertyValue = $ActualValue | Select-Object -ExpandProperty SizeRemaining
[bool] $succeeded = $ActualValuePropertyValue -gt $ExpectedValue
if ($Negate) { $succeeded = -not $succeeded }
$failureMessage = ''
if (-not $succeeded)
{
if ($Negate)
{
$failureMessage = NotArchitestVolumeHaveSizeRemainingFailureMessage -ActualValue $ActualValuePropertyValue -ExpectedValue $ExpectedValue
}
else
{
$failureMessage = ArchitestVolumeHaveSizeRemainingFailureMessage -ActualValue $ActualValuePropertyValue -ExpectedValue $ExpectedValue
}
}
return New-Object psobject -Property @{
Succeeded = $succeeded
FailureMessage = $failureMessage
}
}
function ArchitestVolumeHaveSizeRemaining($ActualValue,$ExpectedValue)
{
return "Expected SizeRemaining {$ActualValue} to be greater than {$ExpectedValue}"
}
function NotArchitestVolumeHaveSizeRemainingFailureMessage($ActualValue,$ExpectedValue)
{
return "Expected SizeRemaining {$ActualValue} to be less than or equal to {$ExpectedValue}"
}
Add-AssertionOperator -Name HaveSizeRemaining `
-Test $function:ArchitestVolumeHaveSizeRemaining `
-Alias 'HSR'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.