Windows PowerShell command on Get-command Context
MyWebUniversity

Windows PowerShell command on Get-command Context

NAME

Context

SYNOPSIS

Provides logical grouping of It blocks within a single Describe block. Any Mocks defined

inside a Context are removed at the end of the Context scope, as are any files or folders

added to the TestDrive during the Context block's execution. Any BeforeEach or AfterEach

blocks defined inside a Context also only apply to tests within that Context .

SYNTAX

Context [-Name] [[-Fixture] ] []

DESCRIPTION

PARAMETERS

-Name

The name of the Context. This is a phrase describing a set of tests within a describe.

Required? true Position? 1 Default value Accept pipeline input? false Accept wildcard characters? false

-Fixture

Script that is executed. This may include setup specific to the context and one or more It blocks that validate the expected outcomes. Required? false Position? 2

Default value $(Throw "No test script block is provided. (Have you put the open curly brace on

the next line?)") Accept pipeline input? false Accept wildcard characters? false This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).

INPUTS

OUTPUTS

-------------------------- EXAMPLE 1 --------------------------

PS C:\>function Add-Numbers($a, $b) {

return $a + $b

}

Describe "Add-Numbers" {

Context "when root does not exist" {

It "..." { ... } }

Context "when root does exist" {

It "..." { ... } It "..." { ... } It "..." { ... } } }

RELATED LINKS

Describe It BeforeEach AfterEach about_Should about_Mocking about_TestDrive



Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 OurUNIX.com ™