SYNOPSIS# Should is a keyword what is used to define an assertion inside It block.
SYNTAX# Copy Should [[-ActualValue] <Object>] [-Be] [-Not] [-ExpectedValue <Object>] [-Because <Object>]
[<CommonParameters>]
BeExactly# Copy Should [[-ActualValue] <Object>] [-Not] [-ExpectedValue <Object>] [-Because <Object>] [-BeExactly]
[<CommonParameters>]
BeGreaterThan# Copy Should [[-ActualValue] <Object>] [-Not] [-ExpectedValue <Object>] [-Because <Object>] [-BeGreaterThan]
[<CommonParameters>]
BeLessOrEqual# Copy Should [[-ActualValue] <Object>] [-Not] [-ExpectedValue <Object>] [-Because <Object>] [-BeLessOrEqual]
[<CommonParameters>]
BeIn# Copy Should [[-ActualValue] <Object>] [-Not] [-ExpectedValue <Object>] [-Because <Object>] [-BeIn]
[<CommonParameters>]
BeLessThan# Copy Should [[-ActualValue] <Object>] [-Not] [-ExpectedValue <Object>] [-Because <Object>] [-BeLessThan]
[<CommonParameters>]
BeGreaterOrEqual# Copy Should [[-ActualValue] <Object>] [-Not] [-ExpectedValue <Object>] [-Because <Object>] [-BeGreaterOrEqual]
[<CommonParameters>]
BeLike# Copy Should [[-ActualValue] <Object>] [-Not] [-ExpectedValue <Object>] [-Because <Object>] [-BeLike]
[<CommonParameters>]
BeLikeExactly# Copy Should [[-ActualValue] <Object>] [-Not] [-ExpectedValue <Object>] [-Because <Object>] [-BeLikeExactly]
[<CommonParameters>]
BeNullOrEmpty# Copy Should [[-ActualValue] <Object>] [-Not] [-Because <Object>] [-BeNullOrEmpty] [<CommonParameters>]
BeOfType# Copy Should [[-ActualValue] <Object>] [-Not] [-Because <Object>] [-BeOfType] [-ExpectedType <Object>]
[<CommonParameters>]
BeTrue# Copy Should [[-ActualValue] <Object>] [-Not] [-Because <Object>] [-BeTrue] [<CommonParameters>]
BeFalse# Copy Should [[-ActualValue] <Object>] [-Not] [-Because <Object>] [-BeFalse] [<CommonParameters>]
Contain# Copy Should [[-ActualValue] <Object>] [-Not] [-ExpectedValue <Object>] [-Because <Object>] [-Contain]
[<CommonParameters>]
Exist# Copy Should [[-ActualValue] <Object>] [-Not] [-Because <Object>] [-Exist] [<CommonParameters>]
FileContentMatch# Copy Should [[-ActualValue] <Object>] [-Not] [-Because <Object>] [-FileContentMatch] [-ExpectedContent <Object>]
[<CommonParameters>]
FileContentMatchExactly# Copy Should [[-ActualValue] <Object>] [-Not] [-Because <Object>] [-ExpectedContent <Object>]
[-FileContentMatchExactly] [<CommonParameters>]
FileContentMatchMultiline# Copy Should [[-ActualValue] <Object>] [-Not] [-Because <Object>] [-ExpectedContent <Object>]
[-FileContentMatchMultiline] [<CommonParameters>]
HaveCount# Copy Should [[-ActualValue] <Object>] [-Not] [-ExpectedValue <Object>] [-Because <Object>] [-HaveCount]
[<CommonParameters>]
HaveParameter# Copy Should [[-ActualValue] <Object>] [-Not] [-Because <Object>] [-HaveParameter] [-ParameterName <Object>]
[-Type <Object>] [-DefaultValue <Object>] [-Mandatory] [-HasArgumentCompleter] [-Alias <Object>]
[<CommonParameters>]
Match# Copy Should [[-ActualValue] <Object>] [-Not] [-Because <Object>] [-Match] [-RegularExpression <Object>]
[<CommonParameters>]
MatchExactly# Copy Should [[-ActualValue] <Object>] [-Not] [-Because <Object>] [-RegularExpression <Object>] [-MatchExactly]
[<CommonParameters>]
Throw# Copy Should [[-ActualValue] <Object>] [-Not] [-Because <Object>] [-Throw] [-ExpectedMessage <Object>]
[-ErrorId <Object>] [-ExceptionType <Object>] [-PassThru] [<CommonParameters>]
InvokeVerifiable# Copy Should [[-ActualValue] <Object>] [-Not] [-InvokeVerifiable] [<CommonParameters>]
Invoke# Copy Should [[-ActualValue] <Object>] [-Not] [-Because <Object>] [-Invoke] [-CommandName <Object>] [-Times <Object>]
[-ParameterFilter <Object>] [-ExclusiveFilter <Object>] [-ModuleName <Object>] [-Scope <Object>] [-Exactly]
[-CallerSessionState <Object>] [<CommonParameters>]
DESCRIPTION# Should is a keyword what is used to define an assertion inside the It block.
Should provides assertion methods for verify assertion e.g.
comparing objects.
If assertion is not met the test fails and an exception is throwed up.
Should can be used more than once in the It block if more than one assertion
need to be verified.
Each Should keywords need to be located in a new line.
Test will be passed only when all assertion will be met (logical conjuction).
EXAMPLES# Example 1# Copy PS C:\> {{ Add example code here }}
{{ Add example description here }}
PARAMETERS# -ActualValue# {{ Fill ActualValue Description }}
Copy Type : Object
Parameter Sets : (All)
Aliases :
Required : False
Position : 1
Default value : None
Accept pipeline input : True (ByValue)
Accept wildcard characters : False
-Alias# {{ Fill Alias Description }}
Copy Type : Object
Parameter Sets : HaveParameter
Aliases :
Required : False
Position : Named
Default value : None
Accept pipeline input : False
Accept wildcard characters : False
-Be# {{ Fill Be Description }}
Copy Type : SwitchParameter
Parameter Sets : Be
Aliases : EQ
Required : True
Position : Named
Default value : None
Accept pipeline input : False
Accept wildcard characters : False
-Because# {{ Fill Because Description }}
Copy Type : Object
Parameter Sets : Be , BeExactly , BeGreaterThan , BeLessOrEqual , BeIn , BeLessThan , BeGreaterOrEqual , BeLike , BeLikeExactly , BeNullOrEmpty , BeOfType , BeTrue , BeFalse , Contain , Exist , FileContentMatch , FileContentMatchExactly , FileContentMatchMultiline , HaveCount , HaveParameter , Match , MatchExactly , Throw , Invoke
Aliases :
Required : False
Position : Named
Default value : None
Accept pipeline input : False
Accept wildcard characters : False
-BeExactly# {{ Fill BeExactly Description }}
Copy Type : SwitchParameter
Parameter Sets : BeExactly
Aliases : CEQ
Required : True
Position : Named
Default value : None
Accept pipeline input : False
Accept wildcard characters : False
-BeFalse# {{ Fill BeFalse Description }}
Copy Type : SwitchParameter
Parameter Sets : BeFalse
Aliases :
Required : True
Position : Named
Default value : None
Accept pipeline input : False
Accept wildcard characters : False
-BeGreaterOrEqual# {{ Fill BeGreaterOrEqual Description }}
Copy Type : SwitchParameter
Parameter Sets : BeGreaterOrEqual
Aliases : GE
Required : True
Position : Named
Default value : None
Accept pipeline input : False
Accept wildcard characters : False
-BeGreaterThan# {{ Fill BeGreaterThan Description }}
Copy Type : SwitchParameter
Parameter Sets : BeGreaterThan
Aliases : GT
Required : True
Position : Named
Default value : None
Accept pipeline input : False
Accept wildcard characters : False
-BeIn# {{ Fill BeIn Description }}
Copy Type : SwitchParameter
Parameter Sets : BeIn
Aliases :
Required : True
Position : Named
Default value : None
Accept pipeline input : False
Accept wildcard characters : False
-BeLessOrEqual# {{ Fill BeLessOrEqual Description }}
Copy Type : SwitchParameter
Parameter Sets : BeLessOrEqual
Aliases : LE
Required : True
Position : Named
Default value : None
Accept pipeline input : False
Accept wildcard characters : False
-BeLessThan# {{ Fill BeLessThan Description }}
Copy Type : SwitchParameter
Parameter Sets : BeLessThan
Aliases : LT
Required : True
Position : Named
Default value : None
Accept pipeline input : False
Accept wildcard characters : False
-BeLike# {{ Fill BeLike Description }}
Copy Type : SwitchParameter
Parameter Sets : BeLike
Aliases :
Required : True
Position : Named
Default value : None
Accept pipeline input : False
Accept wildcard characters : False
-BeLikeExactly# {{ Fill BeLikeExactly Description }}
Copy Type : SwitchParameter
Parameter Sets : BeLikeExactly
Aliases :
Required : True
Position : Named
Default value : None
Accept pipeline input : False
Accept wildcard characters : False
-BeNullOrEmpty# {{ Fill BeNullOrEmpty Description }}
Copy Type : SwitchParameter
Parameter Sets : BeNullOrEmpty
Aliases :
Required : True
Position : Named
Default value : None
Accept pipeline input : False
Accept wildcard characters : False
-BeOfType# {{ Fill BeOfType Description }}
Copy Type : SwitchParameter
Parameter Sets : BeOfType
Aliases : HaveType
Required : True
Position : Named
Default value : None
Accept pipeline input : False
Accept wildcard characters : False
-BeTrue# {{ Fill BeTrue Description }}
Copy Type : SwitchParameter
Parameter Sets : BeTrue
Aliases :
Required : True
Position : Named
Default value : None
Accept pipeline input : False
Accept wildcard characters : False
-CallerSessionState# {{ Fill CallerSessionState Description }}
Copy Type : Object
Parameter Sets : Invoke
Aliases :
Required : False
Position : Named
Default value : None
Accept pipeline input : False
Accept wildcard characters : False
-CommandName# {{ Fill CommandName Description }}
Copy Type : Object
Parameter Sets : Invoke
Aliases :
Required : False
Position : Named
Default value : None
Accept pipeline input : False
Accept wildcard characters : False
-Contain# {{ Fill Contain Description }}
Copy Type : SwitchParameter
Parameter Sets : Contain
Aliases :
Required : True
Position : Named
Default value : None
Accept pipeline input : False
Accept wildcard characters : False
-DefaultValue# {{ Fill DefaultValue Description }}
Copy Type : Object
Parameter Sets : HaveParameter
Aliases :
Required : False
Position : Named
Default value : None
Accept pipeline input : False
Accept wildcard characters : False
-ErrorId# {{ Fill ErrorId Description }}
Copy Type : Object
Parameter Sets : Throw
Aliases :
Required : False
Position : Named
Default value : None
Accept pipeline input : False
Accept wildcard characters : False
-Exactly# {{ Fill Exactly Description }}
Copy Type : SwitchParameter
Parameter Sets : Invoke
Aliases :
Required : False
Position : Named
Default value : None
Accept pipeline input : False
Accept wildcard characters : False
-ExceptionType# {{ Fill ExceptionType Description }}
Copy Type : Object
Parameter Sets : Throw
Aliases :
Required : False
Position : Named
Default value : None
Accept pipeline input : False
Accept wildcard characters : False
-ExclusiveFilter# {{ Fill ExclusiveFilter Description }}
Copy Type : Object
Parameter Sets : Invoke
Aliases :
Required : False
Position : Named
Default value : None
Accept pipeline input : False
Accept wildcard characters : False
-Exist# {{ Fill Exist Description }}
Copy Type : SwitchParameter
Parameter Sets : Exist
Aliases :
Required : True
Position : Named
Default value : None
Accept pipeline input : False
Accept wildcard characters : False
-ExpectedContent# {{ Fill ExpectedContent Description }}
Copy Type : Object
Parameter Sets : FileContentMatch , FileContentMatchExactly , FileContentMatchMultiline
Aliases :
Required : False
Position : Named
Default value : None
Accept pipeline input : False
Accept wildcard characters : False
-ExpectedMessage# {{ Fill ExpectedMessage Description }}
Copy Type : Object
Parameter Sets : Throw
Aliases :
Required : False
Position : Named
Default value : None
Accept pipeline input : False
Accept wildcard characters : False
-ExpectedType# {{ Fill ExpectedType Description }}
Copy Type : Object
Parameter Sets : BeOfType
Aliases :
Required : False
Position : Named
Default value : None
Accept pipeline input : False
Accept wildcard characters : False
-ExpectedValue# {{ Fill ExpectedValue Description }}
Copy Type : Object
Parameter Sets : Be , BeExactly , BeGreaterThan , BeLessOrEqual , BeIn , BeLessThan , BeGreaterOrEqual , BeLike , BeLikeExactly , Contain , HaveCount
Aliases :
Required : False
Position : Named
Default value : None
Accept pipeline input : False
Accept wildcard characters : False
-FileContentMatch# {{ Fill FileContentMatch Description }}
Copy Type : SwitchParameter
Parameter Sets : FileContentMatch
Aliases :
Required : True
Position : Named
Default value : None
Accept pipeline input : False
Accept wildcard characters : False
-FileContentMatchExactly# {{ Fill FileContentMatchExactly Description }}
Copy Type : SwitchParameter
Parameter Sets : FileContentMatchExactly
Aliases :
Required : True
Position : Named
Default value : None
Accept pipeline input : False
Accept wildcard characters : False
-FileContentMatchMultiline# {{ Fill FileContentMatchMultiline Description }}
Copy Type : SwitchParameter
Parameter Sets : FileContentMatchMultiline
Aliases :
Required : True
Position : Named
Default value : None
Accept pipeline input : False
Accept wildcard characters : False
-HasArgumentCompleter# {{ Fill HasArgumentCompleter Description }}
Copy Type : SwitchParameter
Parameter Sets : HaveParameter
Aliases :
Required : False
Position : Named
Default value : None
Accept pipeline input : False
Accept wildcard characters : False
-HaveCount# {{ Fill HaveCount Description }}
Copy Type : SwitchParameter
Parameter Sets : HaveCount
Aliases :
Required : True
Position : Named
Default value : None
Accept pipeline input : False
Accept wildcard characters : False
-HaveParameter# {{ Fill HaveParameter Description }}
Copy Type : SwitchParameter
Parameter Sets : HaveParameter
Aliases :
Required : True
Position : Named
Default value : None
Accept pipeline input : False
Accept wildcard characters : False
-Invoke# {{ Fill Invoke Description }}
Copy Type : SwitchParameter
Parameter Sets : Invoke
Aliases :
Required : True
Position : Named
Default value : None
Accept pipeline input : False
Accept wildcard characters : False
-InvokeVerifiable# {{ Fill InvokeVerifiable Description }}
Copy Type : SwitchParameter
Parameter Sets : InvokeVerifiable
Aliases :
Required : True
Position : Named
Default value : None
Accept pipeline input : False
Accept wildcard characters : False
-Mandatory# {{ Fill Mandatory Description }}
Copy Type : SwitchParameter
Parameter Sets : HaveParameter
Aliases :
Required : False
Position : Named
Default value : None
Accept pipeline input : False
Accept wildcard characters : False
-Match# {{ Fill Match Description }}
Copy Type : SwitchParameter
Parameter Sets : Match
Aliases :
Required : True
Position : Named
Default value : None
Accept pipeline input : False
Accept wildcard characters : False
-MatchExactly# {{ Fill MatchExactly Description }}
Copy Type : SwitchParameter
Parameter Sets : MatchExactly
Aliases : CMATCH
Required : True
Position : Named
Default value : None
Accept pipeline input : False
Accept wildcard characters : False
-ModuleName# {{ Fill ModuleName Description }}
Copy Type : Object
Parameter Sets : Invoke
Aliases :
Required : False
Position : Named
Default value : None
Accept pipeline input : False
Accept wildcard characters : False
-Not# {{ Fill Not Description }}
Copy Type : SwitchParameter
Parameter Sets : (All)
Aliases :
Required : False
Position : Named
Default value : None
Accept pipeline input : False
Accept wildcard characters : False
-ParameterFilter# {{ Fill ParameterFilter Description }}
Copy Type : Object
Parameter Sets : Invoke
Aliases :
Required : False
Position : Named
Default value : None
Accept pipeline input : False
Accept wildcard characters : False
-ParameterName# {{ Fill ParameterName Description }}
Copy Type : Object
Parameter Sets : HaveParameter
Aliases :
Required : False
Position : Named
Default value : None
Accept pipeline input : False
Accept wildcard characters : False
-PassThru# {{ Fill PassThru Description }}
Copy Type : SwitchParameter
Parameter Sets : Throw
Aliases :
Required : False
Position : Named
Default value : None
Accept pipeline input : False
Accept wildcard characters : False
-RegularExpression# {{ Fill RegularExpression Description }}
Copy Type : Object
Parameter Sets : Match , MatchExactly
Aliases :
Required : False
Position : Named
Default value : None
Accept pipeline input : False
Accept wildcard characters : False
-Scope# {{ Fill Scope Description }}
Copy Type : Object
Parameter Sets : Invoke
Aliases :
Required : False
Position : Named
Default value : None
Accept pipeline input : False
Accept wildcard characters : False
-Throw# {{ Fill Throw Description }}
Copy Type : SwitchParameter
Parameter Sets : Throw
Aliases :
Required : True
Position : Named
Default value : None
Accept pipeline input : False
Accept wildcard characters : False
-Times# {{ Fill Times Description }}
Copy Type : Object
Parameter Sets : Invoke
Aliases :
Required : False
Position : Named
Default value : None
Accept pipeline input : False
Accept wildcard characters : False
-Type# {{ Fill Type Description }}
Copy Type : Object
Parameter Sets : HaveParameter
Aliases :
Required : False
Position : Named
Default value : None
Accept pipeline input : False
Accept wildcard characters : False
CommonParameters# This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters .
INPUTS# OUTPUTS# NOTES# RELATED LINKS# https://github.com/pester/Pester/wiki/Should
EDIT THIS PAGE# This page was auto-generated using Pester's comment based help. To edit the content of this page, change the corresponding help in the pester/Pester repository. See our contribution guide for more information.