Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help of New-MockObject and Context updated #841

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Functions/Context.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ apply to tests within that Context .
.PARAMETER Name
The name of the Context. This is a phrase describing a set of tests within a describe.

.PARAMETER Tag
Optional parameter containing an array of strings. When calling Invoke-Pester,
it is possible to specify a -Tag parameter which will only execute Context blocks
containing the same Tag.

.PARAMETER Fixture
Script that is executed. This may include setup specific to the context
and one or more It blocks that validate the expected outcomes.
Expand Down
26 changes: 15 additions & 11 deletions Functions/New-MockObject.ps1
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
function New-MockObject {
<#
.SYNOPSIS
This function instantiates a .NET object from a type. The assembly for the particular type must be
loaded.
<#
.SYNOPSIS
This function instantiates a .NET object from a type.

.PARAMETER Type
The .NET type to create an object from.
.DESCRIPTION
Using the New-MockObject you can mock an object based on .NET type.

.EXAMPLE
PS> $obj = New-MockObject -Type 'System.Diagnostics.Process'
PS> $obj.GetType().FullName
System.Diagnostics.Process
#>
An .NET assembly for the particular type must be available in the system and loaded.

.PARAMETER Type
The .NET type to create an object based on.

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

param (
[Parameter(Mandatory = $true)]
Expand Down