Skip to main content
Version: v4

New-MockObject

This page was generated

Contributions are welcome in Pester v4-repo.

SYNOPSIS

This function instantiates a .NET object from a type.

SYNTAX

New-MockObject [-Type] <type>

DESCRIPTION

Using the New-MockObject you can mock an object based on .NET type.

An .NET assembly for the particular type must be available in the system and loaded.

EXAMPLES

EXAMPLE 1

$obj = New-MockObject -Type 'System.Diagnostics.Process'
$obj.GetType().FullName
System.Diagnostics.Process

PARAMETERS

-Type

The .NET type to create an object based on.

Type: System.Type
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 0
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

NOTES

VERSION

This page was generated using comment-based help in Pester 4.10.1.