full_path stringlengths 31 232 | filename stringlengths 4 167 | content stringlengths 0 48.3M |
|---|---|---|
PowerShellCorpus/Github/dbroeglin_Forge.Netscaler/Tests/Manifest.Tests.ps1 | Manifest.Tests.ps1 | Describe 'Forge.Netscaler Manifest' {
$ModuleName = "Forge.Netscaler"
$ManifestPath = "$PSScriptRoot\..\$ModuleName\$ModuleName.psd1"
Context 'Validation' {
$Script:Manifest = $Script:Manifest = Test-ModuleManifest -Path $ManifestPath
It "has a valid manifest" {
... |
PowerShellCorpus/Github/dbroeglin_Forge.Netscaler/Tests/New-NSGet.Tests.ps1 | New-NSGet.Tests.ps1 | Set-PSDebug -Strict
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.Tests\.', '.'
if (!(Get-Module "Forge")) {
Import-Module "Forge"
}
. "$PSScriptRoot\..\Forge.Netscaler\$sut"
Describe "New-NSGet" {
$Name = "TestGenerator"
$Label = "Test generator label"
$Params = @{
... |
PowerShellCorpus/Github/dbroeglin_Forge.Netscaler/Tests/AppVeyor.Pester.ps1 | AppVeyor.Pester.ps1 | # Taken with love from https://raw.githubusercontent.com/RamblingCookieMonster/PSDiskPart/master/Tests/appveyor.pester.ps1
# This script will invoke pester tests
# We serialize XML results and pull them in appveyor.yml
# If Finalize is specified, we collect XML output, upload tests, and indicate build errors
pa... |
PowerShellCorpus/Github/dbroeglin_Forge.Netscaler/Tests/New-NSNew.Tests.ps1 | New-NSNew.Tests.ps1 | Set-PSDebug -Strict
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.Tests\.', '.'
if (!(Get-Module "Forge")) {
Import-Module "Forge"
}
. "$PSScriptRoot\..\Forge.Netscaler\$sut"
Describe "New-NSNew" {
$Name = "TestGenerator"
$TestPath = Join-Path $TestDrive $Name
$Params = ... |
PowerShellCorpus/Github/dbroeglin_Forge.Netscaler/Tests/New-NSClear.Tests.ps1 | New-NSClear.Tests.ps1 | Set-PSDebug -Strict
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.Tests\.', '.'
. "$PSScriptRoot\..\Forge.Netscaler\$sut"
Describe "New-NSClear" {
It "should just work" {
# TODO: an actual test
}
} |
PowerShellCorpus/Github/rasel01_Simple-Single-Page-Aplication-/source/jobInfo/packages/jQuery.1.9.1/Tools/uninstall.ps1 | uninstall.ps1 | param($installPath, $toolsPath, $package, $project)
. (Join-Path $toolsPath common.ps1)
# Determine the file paths
$projectIntelliSenseFilePath = Join-Path $projectScriptsFolderPath $intelliSenseFileName
$origIntelliSenseFilePath = Join-Path $toolsPath $intelliSenseFileName
if (Test-Path $projectIntelliSense... |
PowerShellCorpus/Github/rasel01_Simple-Single-Page-Aplication-/source/jobInfo/packages/jQuery.1.9.1/Tools/install.ps1 | install.ps1 | param($installPath, $toolsPath, $package, $project)
. (Join-Path $toolsPath common.ps1)
# VS 11 and above supports the new intellisense JS files
$vsVersion = [System.Version]::Parse($dte.Version)
$supportsJsIntelliSenseFile = $vsVersion.Major -ge 11
if (-not $supportsJsIntelliSenseFile) {
$displayVersio... |
PowerShellCorpus/Github/rasel01_Simple-Single-Page-Aplication-/source/jobInfo/packages/jQuery.1.9.1/Tools/common.ps1 | common.ps1 | function Get-Checksum($file) {
$cryptoProvider = New-Object "System.Security.Cryptography.MD5CryptoServiceProvider"
$fileInfo = Get-Item $file
trap { ;
continue } $stream = $fileInfo.OpenRead()
if ($? -eq $false) {
# Couldn't open file for reading
return $null
}
$bytes = $... |
PowerShellCorpus/Github/rasel01_Simple-Single-Page-Aplication-/source/jobInfo/packages/EntityFramework.6.1.1/tools/init.ps1 | init.ps1 | param($installPath, $toolsPath, $package, $project)
if (Get-Module | ?{ $_.Name -eq 'EntityFramework' })
{
Remove-Module EntityFramework
}
Import-Module (Join-Path $toolsPath EntityFramework.psd1)
# SIG # Begin signature block
# MIIa4AYJKoZIhvcNAQcCoIIa0TCCGs0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQ... |
PowerShellCorpus/Github/rasel01_Simple-Single-Page-Aplication-/source/jobInfo/packages/EntityFramework.6.1.1/tools/install.ps1 | install.ps1 | param($installPath, $toolsPath, $package, $project)
Initialize-EFConfiguration $project
Add-EFProvider $project 'System.Data.SqlClient' 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer'
Write-Host
Write-Host "Type 'get-help EntityFramework' to see all available Entity Framework comma... |
PowerShellCorpus/Github/rasel01_Simple-Single-Page-Aplication-/source/jobInfo/packages/Newtonsoft.Json.6.0.4/tools/install.ps1 | install.ps1 | param($installPath, $toolsPath, $package, $project)
# open json.net splash page on package install
# don't open if json.net is installed as a dependency
try
{
$url = "http://james.newtonking.com/json"
$dte2 = Get-Interface $dte ([EnvDTE80.DTE2])
if ($dte2.ActiveWindow.Caption -eq "Package Manager Con... |
PowerShellCorpus/Github/luciusbono_restoreConferenceRooms/RestoreBackup.ps1 | RestoreBackup.ps1 | None |
PowerShellCorpus/Github/luciusbono_restoreConferenceRooms/restoreConferenceRooms.ps1 | restoreConferenceRooms.ps1 | param($inputfile, $backupPath = [Environment]::GetFolderPath("Desktop")+'\'+'ConfBackupData-'+(Get-Date -format M-d-yyyy)+'.csv')
$data = Import-Csv $inputfile
#First, back up all the conference rooms that will be changed
$(Foreach ($item in $data)
{
Get-ADUser $item.samaccountname -Properties samaccountname,... |
PowerShellCorpus/Github/mbdent_sysinfo/get-sysinfo.ps1 | get-sysinfo.ps1 |
function Get-DotNetVersion
{
Clear-Host
Write-Host 'Installed .NET Framework Components' -ForegroundColor Yellow
Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -Recurse |
Get-ItemProperty -Name Version,Release -ErrorAction 0 |
Where-Object { $_.PSChildName -match '^(?!S)\p{... |
PowerShellCorpus/Github/josephB_Simple-PScode/check_tcp_sessions.ps1 | check_tcp_sessions.ps1 | <#
.Synopsis
Count TCP connections for a specific state
state in Established, TimeWait, SynSent
.DESCRIPTION
<Check Active TCP sessions count>
.PARAMETER <paramName>
<-w warning -c critical -T state>
.Example
<check_tcp_sessions.ps1 -w 10 -c 30 -T TimeWait>
.Author
J. Bonnet
#>
... |
PowerShellCorpus/Github/josephB_Simple-PScode/cleanup_dir.ps1 | cleanup_dir.ps1 | function M4Temp_cleanup($path) {
$old = 5
$now = Get-Date
Get-ChildItem $path -Recurse | Where-Object {-not $_.PSIsContainer -and $now.Subtract($_.LastWriteTime).Days -gt $old } | Remove-Item
} |
PowerShellCorpus/Github/skitau_sysadmin/Set-UPNfromEMail.ps1 | Set-UPNfromEMail.ps1 | <#TODO
# Tidy for script operation with parameters
# Parameters for write and rollback
# Implement pssessions for remote operation
#>
<#
.SYNOPSIS
Set UPN for Active Directory users based on their email address
.DESCRIPTION
Gather AD Users, their UPN and e-mail address ready for settin... |
PowerShellCorpus/Github/doguico_mirrorapi/MirrorApiPoc/packages/EntityFramework.6.1.1/tools/init.ps1 | init.ps1 | param($installPath, $toolsPath, $package, $project)
if (Get-Module | ?{ $_.Name -eq 'EntityFramework' })
{
Remove-Module EntityFramework
}
Import-Module (Join-Path $toolsPath EntityFramework.psd1)
# SIG # Begin signature block
# MIIa4AYJKoZIhvcNAQcCoIIa0TCCGs0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQ... |
PowerShellCorpus/Github/doguico_mirrorapi/MirrorApiPoc/packages/EntityFramework.6.1.1/tools/install.ps1 | install.ps1 | param($installPath, $toolsPath, $package, $project)
Initialize-EFConfiguration $project
Add-EFProvider $project 'System.Data.SqlClient' 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer'
Write-Host
Write-Host "Type 'get-help EntityFramework' to see all available Entity Framework comma... |
PowerShellCorpus/Github/OPSTest_E2E_Provision_1487959540779/.openpublishing.build.ps1 | .openpublishing.build.ps1 | param(
[string]$buildCorePowershellUrl = "https://opbuildstoragesandbox2.blob.core.windows.net/opps1container/.openpublishing.buildcore.ps1",
[string]$parameters
)
# Main
$errorActionPreference = 'Stop'
# Step-1: Download buildcore script to local
echo "download build core script to local with source u... |
PowerShellCorpus/Github/vectradltd_azuregithubtest/azurgithubtest/Deploy-AzureResourceGroup.ps1 | Deploy-AzureResourceGroup.ps1 | #Requires -Version 3.0
#Requires -Module AzureRM.Resources
#Requires -Module Azure.Storage
Param(
[string] [Parameter(Mandatory=$true)] $ResourceGroupLocation,
[string] $ResourceGroupName = 'azurgithubtest',
[switch] $UploadArtifacts,
[string] $StorageAccountName,
[string] $StorageContaine... |
PowerShellCorpus/Github/akamac_WinCloudInit/plugins/11-cert.ps1 | 11-cert.ps1 | [CmdletBinding()]
param(
$Config
)
# pfx/p12 and cer/crt are supported
@($Config.Certificates) -ne $null | % {
$CertificatePath = if (($Uri = [uri]$_.Url).Scheme) {
$tmp = Join-Path ([System.IO.Path]::GetTempPath()) $Uri.Segments[-1]
Invoke-WebRequest -Uri $Uri -OutFile $tmp
$... |
PowerShellCorpus/Github/akamac_WinCloudInit/plugins/28-disk.ps1 | 28-disk.ps1 | [CmdletBinding()]
param(
$Config
)
Write-Verbose 'Extending existing volumes'
'rescan' | diskpart
(Get-CimInstance -Class Win32_Volume -Property Name -Verbose:$false).Name -match ':' | % {
"select volume $_",'extend' | diskpart
}
# config source here! check plugin execution order
Write-Verbose 'Ch... |
PowerShellCorpus/Github/akamac_WinCloudInit/plugins/04-network.ps1 | 04-network.ps1 | [CmdletBinding()]
param(
$Config
)
function ConvertTo-SubnetMask ([int]$SubnetMaskLength) {
$SubnetMask = -1 -shl (32 - $SubnetMaskLength)
$Bytes = [BitConverter]::GetBytes($SubnetMask)
if ([BitConverter]::IsLittleEndian) {
[array]::Reverse($Bytes)
}
[ipaddress]$Bytes
}
W... |
PowerShellCorpus/Github/akamac_WinCloudInit/plugins/16-rdp.ps1 | 16-rdp.ps1 | [CmdletBinding()]
param(
$Config
)
if ($Config.RDP) {
Write-Verbose 'Allow RDP'
Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server' -Name fDenyTSConnections -Value 0
Write-Verbose 'Enable Network Level Authentication'
Set-ItemProperty -Path 'HKLM:\System\Current... |
PowerShellCorpus/Github/akamac_WinCloudInit/plugins/01-reboot.ps1 | 01-reboot.ps1 | [CmdletBinding()]
param(
$Config
)
Sleep 60
'reboot'
Restart-Computer
|
PowerShellCorpus/Github/akamac_WinCloudInit/plugins/12-winrm.ps1 | 12-winrm.ps1 | [CmdletBinding()]
param(
$Config
)
if ($Config.WinRM) {
#Write-Verbose 'Enabling WinRM'
#Enable-PSRemoting -Force | Out-Null
#winrm quickconfig -transport:https
#winrm enumerate winrm/config/listener
Write-Verbose 'Configuring firewall WinRM exception'
#Enable-NetFirewallRule -Di... |
PowerShellCorpus/Github/akamac_WinCloudInit/plugins/03-hostname.ps1 | 03-hostname.ps1 | [CmdletBinding()]
param(
$Config
)
# cannot rename domain machine
if ($Config.HostName -and
$env:COMPUTERNAME -ne $Config.HostName -and
-not [System.Net.DNS]::GetHostByName('').HostName.Contains('.')) {
Write-Verbose "Renaming computer to $($Config.HostName)"
'reboot' # system will be re... |
PowerShellCorpus/Github/akamac_WinCloudInit/plugins/20-firewall.ps1 | 20-firewall.ps1 | [CmdletBinding()]
param(
$Config
)
if ($Config.Firewall.Disabled) {
Write-Verbose 'Disabling firewall'
#Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False
netsh advfirewall set allprofiles state off
} |
PowerShellCorpus/Github/akamac_WinCloudInit/plugins/02-sysprep.ps1 | 02-sysprep.ps1 | [CmdletBinding()]
param(
$Config
)
if ($Config.Sysprep) {
$Unattend = switch -Wildcard ((Get-CimInstance -Class Win32_OperatingSystem -Verbose:$false).Caption) {
'*2012 R2*' { 'unattend_2K12R2.xml' }
'*2008 R2*' { 'unattend_2K8R2.xml' }
default { throw 'OS unsupported' }
}... |
PowerShellCorpus/Github/akamac_WinCloudInit/plugins/10-posh.ps1 | 10-posh.ps1 | [CmdletBinding()]
param(
$Config
)
if ($Config.ExecutionPolicy) {
Write-Verbose "Setting ExecutionPolicy to $($Config.ExecutionPolicy)"
Set-ExecutionPolicy $Config.ExecutionPolicy -Scope LocalMachine -Force
} |
PowerShellCorpus/Github/akamac_WinCloudInit/plugins/09-user.ps1 | 09-user.ps1 | [CmdletBinding()]
param(
$Config
)
$Computer = [ADSI]"WinNT://$env:COMPUTERNAME,computer"
@($Config.Groups) -ne $null | % {
$Group = $Computer.Create('Group', $_)
$Group.SetInfo()
}
@($Config.Users) -ne $null | % {
if ($_.OldName) {
$User = [ADSI]"WinNT://$env:COMPUTERNAME/$($_.... |
PowerShellCorpus/Github/akamac_WinCloudInit/plugins/24-activation.ps1 | 24-activation.ps1 | [CmdletBinding()]
param(
$Config
)
if ($Config.ProductKey) {
Write-Verbose 'Setting product key'
slmgr /ipk $Config.ProductKey
Write-Verbose 'Activating Windows'
slmgr /ato
} |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/run.ps1 | run.ps1 | $in = Get-Content $req -Raw | ConvertFrom-Json
$name = $in.name
if ($req_query_name)
{
$name = $req_query_name
}
Out-File -Encoding Ascii -FilePath $res -inputObject "Hello $name"
. "D:\home\site\wwwroot\PSTrigger1\bin\Add-Numbers.ps1"
Add-Numbers $in.a $in.b |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Add-Numbers.ps1 | Add-Numbers.ps1 | function Add-Numbers($a, $b) {
return $a + $b
}
|
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Add-Numbers.Tests.ps1 | Add-Numbers.Tests.ps1 | $here = Split-Path -Parent $MyInvocation.MyCommand.Path
. "$here\Add-Numbers.ps1"
Describe -Tags "Example" "Add-Numbers" {
It "adds positive numbers" {
Add-Numbers 2 3 | Should Be 5
}
It "adds negative numbers" {
Add-Numbers (-2) (-2) | Should Be (-4)
}
It "adds one ... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Pester.Tests.ps1 | Pester.Tests.ps1 | $here = Split-Path -Parent $MyInvocation.MyCommand.Path
$manifestPath = "$here\Pester.psd1"
$changeLogPath = "$here\CHANGELOG.md"
# DO NOT CHANGE THIS TAG NAME; IT AFFECTS THE CI BUILD.
Describe -Tags 'VersionChecks' "Pester manifest and changelog" {
$script:manifest = $null
It "has a valid manife... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Examples/Validator/Validator.Tests.ps1 | Validator.Tests.ps1 |
function MyValidator($thing_to_validate) {
return $thing_to_validate.StartsWith("s")
}
function Invoke-SomethingThatUsesMyValidator {
param(
[ValidateScript({MyValidator $_})]
$some_param
)
}
Describe "Testing a validator" {
It "calls MyValidator" {
Mock MyVali... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Examples/Calculator/Add-Numbers.ps1 | Add-Numbers.ps1 | function Add-Numbers($a, $b) {
return $a + $b
}
|
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Examples/Calculator/Add-Numbers.Tests.ps1 | Add-Numbers.Tests.ps1 | $here = Split-Path -Parent $MyInvocation.MyCommand.Path
. "$here\Add-Numbers.ps1"
Describe -Tags "Example" "Add-Numbers" {
It "adds positive numbers" {
Add-Numbers 2 3 | Should Be 5
}
It "adds negative numbers" {
Add-Numbers (-2) (-2) | Should Be (-4)
}
It "adds one ... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/It.Tests.ps1 | It.Tests.ps1 | Set-StrictMode -Version Latest
InModuleScope Pester {
Describe 'Get-PesterResult' {
}
Describe 'It - Implementation' {
$testState = New-PesterState -Path $TestDrive
It 'Throws an error if It is called outside of Describe' {
$scriptBlock = { ItImpl -Pester $testState ... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/TestsRunningInCleanRunspace.Tests.ps1 | TestsRunningInCleanRunspace.Tests.ps1 | function Invoke-PesterInJob ($ScriptBlock, [switch] $GenerateNUnitReport)
{
$PesterPath = Get-Module Pester | Select-Object -First 1 -ExpandProperty Path
$job = Start-Job {
param ($PesterPath, $TestDrive, $ScriptBlock, $GenerateNUnitReport)
Import-Module $PesterPath -Force | Out-Null
... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/TestDrive.ps1 | TestDrive.ps1 | #
function New-TestDrive ([Switch]$PassThru) {
$Path = New-RandomTempDirectory
$DriveName = "TestDrive"
if (-not (& $SafeCommands['Test-Path'] -Path $Path))
{
& $SafeCommands['New-Item'] -ItemType Container -Path $Path | & $SafeCommands['Out-Null']
}
#setup the test drive
... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/BreakAndContinue.Tests.ps1 | BreakAndContinue.Tests.ps1 | Describe 'Clean handling of break and continue' {
# If this test 'fails', it'll just cause most of the rest of the tests to never execute (and we won't see any actual failures.)
# The CI job monitors metrics, though, and will fail the build if the number of tests drops too much.
Context 'Break' {
... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/New-Fixture.ps1 | New-Fixture.ps1 | function New-Fixture {
<#
.SYNOPSIS
This function generates two scripts, one that defines a function
and another one that contains its tests.
.DESCRIPTION
This function generates two scripts, one that defines a function
and another one that contains its tests. The files are by defau... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/TestResults.ps1 | TestResults.ps1 | function Get-HumanTime($Seconds) {
if($Seconds -gt 0.99) {
$time = [math]::Round($Seconds, 2)
$unit = 's'
}
else {
$time = [math]::Floor($Seconds * 1000)
$unit = 'ms'
}
return "$time$unit"
}
function GetFullPath ([string]$Path) {
if (-not [System.IO.... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/TestDrive.Tests.ps1 | TestDrive.Tests.ps1 | Set-StrictMode -Version Latest
$tempPath = (Get-Item $env:temp).FullName
Describe "Setup" {
It "returns a location that is in a temp area" {
$testDrivePath = (Get-Item $TestDrive).FullName
$testDrivePath -like "$tempPath*" | Should Be $true
}
It "creates a drive location called ... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/InModuleScope.Tests.ps1 | InModuleScope.Tests.ps1 | Set-StrictMode -Version Latest
Describe "Module scope separation" {
Context "When users define variables with the same name as Pester parameters" {
$test = "This is a test."
It "does not hide user variables" {
$test | Should Be 'This is a test.'
}
}
It "Does... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/In.Tests.ps1 | In.Tests.ps1 | Set-StrictMode -Version Latest
InModuleScope Pester {
Describe "the In statement" {
Setup -Dir "test_path"
It "executes a command in that directory" {
In "$TestDrive" -Execute { "" | Out-File "test_file" }
"$TestDrive\test_file" | Should Exist
}
... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/SetupTeardown.ps1 | SetupTeardown.ps1 | function BeforeEach
{
<#
.SYNOPSIS
Defines a series of steps to perform at the beginning of every It block within
the current Context or Describe block.
.DESCRIPTION
BeforeEach, AfterEach, BeforeAll, and AfterAll are unique in that they apply
to the entire Context or Describe block, regardless... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/GlobalMock-B.Tests.ps1 | GlobalMock-B.Tests.ps1 | # This test depends on some state set up in GlobalMock-A.Tests.ps1. The behavior we're verifying
# is that global functions that have been mocked are still properly set up even after the test
# script exits its scope.
$functionName = '01c1a57716fe4005ac1a7bf216f38ad0'
try
{
Describe 'Mocking Global Funct... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/Coverage.ps1 | Coverage.ps1 | if ($PSVersionTable.PSVersion.Major -le 2)
{
function Exit-CoverageAnalysis { }
function Get-CoverageReport { }
function Show-CoverageReport { }
function Enter-CoverageAnalysis {
param ( $CodeCoverage )
if ($CodeCoverage) { & $SafeCommands['Write-Error'] 'Code coverage analysis ... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/New-Fixture.Tests.ps1 | New-Fixture.Tests.ps1 | Set-StrictMode -Version Latest
Describe "New-Fixture" {
It "Name parameter is mandatory:" {
(get-command New-Fixture ).Parameters.Name.ParameterSets.__AllParameterSets.IsMandatory | Should Be $true
}
Context "Only Name parameter is specified:" {
It "Creates fixture in current direc... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/Describe.Tests.ps1 | Describe.Tests.ps1 | Set-StrictMode -Version Latest
Describe 'Testing Describe' {
It 'Has a non-mandatory fixture parameter which throws the proper error message if missing' {
$command = Get-Command Describe -Module Pester
$command | Should Not Be $null
$parameter = $command.Parameters['Fixture']
... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/Context.Tests.ps1 | Context.Tests.ps1 | Set-StrictMode -Version Latest
Describe 'Testing Context' {
It 'Has a non-mandatory fixture parameter which throws the proper error message if missing' {
$command = Get-Command Context -Module Pester
$command | Should Not Be $null
$parameter = $command.Parameters['Fixture']
... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/TestResults.Tests.ps1 | TestResults.Tests.ps1 | Set-StrictMode -Version Latest
InModuleScope Pester {
Describe "Write nunit test results (Legacy)" {
Setup -Dir "Results"
It "should write a successful test result" {
#create state
$TestResults = New-PesterState -Path TestDrive:\
$testResults.EnterDescr... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/PesterState.ps1 | PesterState.ps1 | function New-PesterState
{
param (
[String[]]$TagFilter,
[String[]]$ExcludeTagFilter,
[String[]]$TestNameFilter,
[System.Management.Automation.SessionState]$SessionState,
[Switch]$Strict,
[Switch]$Quiet,
[object]$PesterOption
)
if ($null -... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/PesterState.Tests.ps1 | PesterState.Tests.ps1 | Set-StrictMode -Version Latest
InModuleScope Pester {
Describe "New-PesterState" {
Context "TestNameFilter parameter is set" {
$p = new-pesterstate -TestNameFilter "filter"
it "sets the TestNameFilter property" {
$p.TestNameFilter | should be "filter"
... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/Context.ps1 | Context.ps1 | function 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... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/Mock.Tests.ps1 | Mock.Tests.ps1 | Set-StrictMode -Version Latest
function FunctionUnderTest
{
[CmdletBinding()]
param (
[Parameter(Mandatory=$false)]
[string]
$param1
)
return "I am a real world test"
}
function FunctionUnderTestWithoutParams([string]$param1) {
return "I am a real world test... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/Coverage.Tests.ps1 | Coverage.Tests.ps1 | if ($PSVersionTable.PSVersion.Major -le 2) { return }
InModuleScope Pester {
Describe 'Code Coverage Analysis' {
$root = (Get-PSDrive TestDrive).Root
$null = New-Item -Path $root\TestScript.ps1 -ItemType File -ErrorAction SilentlyContinue
Set-Content -Path $root\TestScript.ps1 -Va... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/It.ps1 | It.ps1 | function It {
<#
.SYNOPSIS
Validates the results of a test inside of a Describe block.
.DESCRIPTION
The It command is intended to be used inside of a Describe or Context Block.
If you are familiar with the AAA pattern (Arrange-Act-Assert), the body of
the It block is the appropriate location for an assert. The... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/In.ps1 | In.ps1 | function In {
<#
.SYNOPSIS
A convenience function that executes a script from a specified path.
.DESCRIPTION
Before the script block passed to the execute parameter is invoked,
the current location is set to the path specified. Once the script
block has been executed, the location will be reset to the location... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/SetupTeardown.Tests.ps1 | SetupTeardown.Tests.ps1 | Describe 'Describe-Scoped Test Case setup' {
BeforeEach {
$testVariable = 'From BeforeEach'
}
$testVariable = 'Set in Describe'
It 'Assigns the correct value in first test' {
$testVariable | Should Be 'From BeforeEach'
$testVariable = 'Set in It'
}
It 'Assi... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/GlobalMock-A.Tests.ps1 | GlobalMock-A.Tests.ps1 | # This script exists to create and mock a global function, then exit. The actual behavior
# that we need to test is covered in GlobalMock-B.Tests.ps1, where we make sure that the
# global function was properly restored in its scope.
$functionName = '01c1a57716fe4005ac1a7bf216f38ad0'
if (Test-Path Function:\$fu... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/InModuleScope.ps1 | InModuleScope.ps1 | function InModuleScope
{
<#
.SYNOPSIS
Allows you to execute parts of a test script within the
scope of a PowerShell script module.
.DESCRIPTION
By injecting some test code into the scope of a PowerShell
script module, you can use non-exported functions, aliases
and variables inside that module, ... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/Mock.ps1 | Mock.ps1 | function Mock {
<#
.SYNOPSIS
Mocks the behavior of an existing command with an alternate
implementation.
.DESCRIPTION
This creates new behavior for any existing command within the scope of a
Describe or Context block. The function allows you to specify a script block
that will become the command's new behav... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/Describe.ps1 | Describe.ps1 | function Describe {
<#
.SYNOPSIS
Creates a logical group of tests. All Mocks and TestDrive contents
defined within a Describe block are scoped to that Describe; they
will no longer be present when the Describe block exits. A Describe
block may contain any number of Context and It blocks.
.PARAMETER Name
The... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/Assertions/Match.ps1 | Match.ps1 |
function PesterMatch($value, $expectedMatch) {
return ($value -match $expectedMatch)
}
function PesterMatchFailureMessage($value, $expectedMatch) {
return "Expected: {$value} to match the expression {$expectedMatch}"
}
function NotPesterMatchFailureMessage($value, $expectedMatch) {
return "Expe... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/Assertions/MatchExactly.Tests.ps1 | MatchExactly.Tests.ps1 | Set-StrictMode -Version Latest
InModuleScope Pester {
Describe "MatchExactly" {
It "returns true for things that match exactly" {
PesterMatchExactly "foobar" "ob" | Should Be $true
}
It "returns false for things that do not match exactly" {
PesterMatchExact... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/Assertions/Set-TestInconclusive.ps1 | Set-TestInconclusive.ps1 | function New-InconclusiveErrorRecord ([string] $Message, [string] $File, [string] $Line, [string] $LineText) {
$exception = New-Object Exception $Message
$errorID = 'PesterTestInconclusive'
$errorCategory = [Management.Automation.ErrorCategory]::InvalidResult
# we use ErrorRecord.TargetObject to pas... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/Assertions/PesterThrow.Tests.ps1 | PesterThrow.Tests.ps1 | Set-StrictMode -Version Latest
InModuleScope Pester {
Describe "PesterThrow" {
It "returns true if the statement throws an exception" {
Test-PositiveAssertion (PesterThrow { throw })
}
It "returns false if the statement does not throw an exception" {
Test-N... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/Assertions/BeNullOrEmpty.ps1 | BeNullOrEmpty.ps1 |
function PesterBeNullOrEmpty($value) {
if ($null -eq $value) {
return $true
}
if ([String] -eq $value.GetType()) {
return [String]::IsNullOrEmpty($value)
}
if ($null -ne $value.PSObject.Properties['Count'] -and
$null -ne $value.Count) {
return $value.Count ... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/Assertions/BeLikeExactly.ps1 | BeLikeExactly.ps1 |
function PesterBeLikeExactly($value, $expectedMatch) {
return ($value -clike $expectedMatch)
}
function PesterBeLikeExactlyFailureMessage($value, $expectedMatch) {
return "Expected: {$value} to be exactly like the wildcard {$expectedMatch}"
}
function NotPesterBeLikeExactlyFailureMessage($value, $ex... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/Assertions/Should.Tests.ps1 | Should.Tests.ps1 | Set-StrictMode -Version Latest
InModuleScope Pester {
Describe "Parse-ShouldArgs" {
It "sanitizes assertions functions" {
$parsedArgs = Parse-ShouldArgs TestFunction
$parsedArgs.AssertionMethod | Should Be PesterTestFunction
}
It "works with strict mode whe... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/Assertions/BeLike.ps1 | BeLike.ps1 |
function PesterBeLike($value, $expectedMatch) {
return ($value -like $expectedMatch)
}
function PesterBeLikeFailureMessage($value, $expectedMatch) {
return "Expected: {$value} to be like the wildcard {$expectedMatch}"
}
function NotPesterBeLikeFailureMessage($value, $expectedMatch) {
return "Ex... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/Assertions/Exist.ps1 | Exist.ps1 |
function PesterExist($value) {
& $SafeCommands['Test-Path'] $value
}
function PesterExistFailureMessage($value) {
return "Expected: {$value} to exist"
}
function NotPesterExistFailureMessage($value) {
return "Expected: ${value} to not exist, but it was found"
}
|
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/Assertions/BeLikeExactly.Tests.ps1 | BeLikeExactly.Tests.ps1 | Set-StrictMode -Version Latest
InModuleScope Pester {
Describe "BeLike" {
It "returns true for things that are like wildcard" {
PesterBeLikeExactly "FOOBAR" "*OB*" | Should Be $true
}
It "returns false for things that do not match" {
PesterBeLikeExactly "fo... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/Assertions/PesterThrow.ps1 | PesterThrow.ps1 |
$ActualExceptionMessage = ""
$ActualExceptionWasThrown = $false
# because this is a script block, the user will have to
# wrap the code they want to assert on in { }
function PesterThrow([scriptblock] $script, $expectedErrorMessage) {
if ($null -eq $script) {
throw (New-Object -TypeName Argument... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/Assertions/BeLessThan.Tests.ps1 | BeLessThan.Tests.ps1 | Set-StrictMode -Version Latest
InModuleScope Pester {
Describe "PesterBeLessThan" {
It "passes if value Less than expected" {
Test-PositiveAssertion (PesterBeLessThan 1 2)
1 | Should BeLessThan 2
}
It "fails if values equal" {
Test-NegativeAssert... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/Assertions/BeGreaterThan.ps1 | BeGreaterThan.ps1 | function PesterBeGreaterThan($value, $expected)
{
return [bool]($value -gt $expected)
}
function PesterBeGreaterThanFailureMessage($value,$expected)
{
return "Expected {$value} to be greater than {$expected}"
}
function NotPesterBeGreaterThanFailureMessage($value,$expected)
{
return "Expected ... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/Assertions/BeNullOrEmpty.Tests.ps1 | BeNullOrEmpty.Tests.ps1 | Set-StrictMode -Version Latest
InModuleScope Pester {
Describe "PesterBeNullOrEmpty" {
It "should return true if null" {
Test-PositiveAssertion (PesterBeNullOrEmpty $null)
}
It "should return true if empty string" {
Test-PositiveAssertion (PesterBeNullOrEmp... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/Assertions/MatchExactly.ps1 | MatchExactly.ps1 |
function PesterMatchExactly($value, $expectedMatch) {
return ($value -cmatch $expectedMatch)
}
function PesterMatchExactlyFailureMessage($value, $expectedMatch) {
return "Expected: {$value} to exactly match the expression {$expectedMatch}"
}
function NotPesterMatchExactlyFailureMessage($value, $expe... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/Assertions/Match.Tests.ps1 | Match.Tests.ps1 | Set-StrictMode -Version Latest
InModuleScope Pester {
Describe "Match" {
It "returns true for things that match" {
PesterMatch "foobar" "ob" | Should Be $true
}
It "returns false for things that do not match" {
PesterMatch "foobar" "slime" | Should Be $fals... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/Assertions/BeGreaterThan.Tests.ps1 | BeGreaterThan.Tests.ps1 | Set-StrictMode -Version Latest
InModuleScope Pester {
Describe "PesterBeGreaterThan" {
It "passes if value greater than expected" {
Test-PositiveAssertion (PesterBeGreaterThan 2 1)
2 | Should BeGreaterThan 1
}
It "fails if values equal" {
Test-Ne... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/Assertions/BeLike.Tests.ps1 | BeLike.Tests.ps1 | Set-StrictMode -Version Latest
InModuleScope Pester {
Describe "BeLike" {
It "returns true for things that are like wildcard" {
PesterBeLike "foobar" "*ob*" | Should Be $true
}
It "returns false for things that do not match" {
PesterBeLike "foobar" "oob" | ... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/Assertions/Be.ps1 | Be.ps1 | #Be
function PesterBe($value, $expected) {
return ($expected -eq $value)
}
function PesterBeFailureMessage($value, $expected) {
if (-not (($expected -is [string]) -and ($value -is [string])))
{
return "Expected: {$expected}`nBut was: {$value}"
}
<#joining the output strings to a ... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/Assertions/Contain.Tests.ps1 | Contain.Tests.ps1 | Set-StrictMode -Version Latest
InModuleScope Pester {
Describe "PesterContain" {
Context "when testing file contents" {
Setup -File "test.txt" "this is line 1`nrush is awesome`nAnd this is Unicode: ☺"
It "returns true if the file contains the specified content" {
... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/Assertions/Test-Assertion.ps1 | Test-Assertion.ps1 |
function Test-PositiveAssertion($result) {
if (-not $result) {
throw "Expecting expression to pass, but it failed"
}
}
function Test-NegativeAssertion($result) {
if ($result) {
throw "Expecting expression to pass, but it failed"
}
}
|
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/Assertions/BeOfType.Tests.ps1 | BeOfType.Tests.ps1 | Set-StrictMode -Version Latest
InModuleScope Pester {
Describe "PesterBeOfType" {
It "passes if value is of the expected type" {
Test-PositiveAssertion (PesterBeOfType 1 ([int]))
Test-PositiveAssertion (PesterBeOfType 1 "Int")
1 | Should BeOfType Int
... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/Assertions/Contain.ps1 | Contain.ps1 |
function PesterContain($file, $contentExpecation) {
return ((& $SafeCommands['Get-Content'] -Encoding UTF8 $file) -match $contentExpecation)
}
function PesterContainFailureMessage($file, $contentExpecation) {
return "Expected: file ${file} to contain {$contentExpecation}"
}
function NotPesterContain... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/Assertions/Should.ps1 | Should.ps1 | function Parse-ShouldArgs([array] $shouldArgs) {
if ($null -eq $shouldArgs) { $shouldArgs = @() }
$parsedArgs = @{
PositiveAssertion = $true
ExpectedValue = $null
}
$assertionMethodIndex = 0
$expectedValueIndex = 1
if ($shouldArgs.Count -gt 0 -and $shouldArgs[0].T... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/Assertions/BeOfType.ps1 | BeOfType.ps1 |
function PesterBeOfType($value, $expectedType) {
trap [System.Management.Automation.PSInvalidCastException] { return $false }
if($expectedType -is [string] -and !($expectedType -as [Type])) {
$expectedType = $expectedType -replace '^\[(.*)\]$','$1'
}
return [bool]($value -is $expectedType... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/Assertions/Exist.Tests.ps1 | Exist.Tests.ps1 | Set-StrictMode -Version Latest
InModuleScope Pester {
Describe "PesterExist" {
It "returns true for paths that exist" {
Test-PositiveAssertion (PesterExist $TestDrive)
}
It "returns false for paths do not exist" {
Test-NegativeAssertion (PesterExist "$TestD... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/Assertions/BeLessThan.ps1 | BeLessThan.ps1 | function PesterBeLessThan($value, $expected)
{
return [bool]($value -lt $expected)
}
function PesterBeLessThanFailureMessage($value,$expected)
{
return "Expected {$value} to be less than {$expected}"
}
function NotPesterBeLessThanFailureMessage($value,$expected)
{
return "Expected {$value} to ... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/Assertions/Be.Tests.ps1 | Be.Tests.ps1 | Set-StrictMode -Version Latest
InModuleScope Pester {
Describe "PesterBe" {
It "returns true if the 2 arguments are equal" {
Test-PositiveAssertion (PesterBe 1 1)
}
It "returns true if the 2 arguments are equal and have different case" {
Test-PositiveAssertio... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/Assertions/ContainExactly.Tests.ps1 | ContainExactly.Tests.ps1 | Set-StrictMode -Version Latest
InModuleScope Pester {
Describe "PesterContainExactly" {
Context "when testing file contents" {
Setup -File "test.txt" "this is line 1`nPester is awesome`nAnd this is Unicode: ☺"
It "returns true if the file contains the specified content exactly... |
PowerShellCorpus/Github/marcusclayton_AzureFunctions-PS/PSTrigger1/bin/Pester/3.4.3/Functions/Assertions/ContainExactly.ps1 | ContainExactly.ps1 | function PesterContainExactly($file, $contentExpecation) {
return ((& $SafeCommands['Get-Content'] -Encoding UTF8 $file) -cmatch $contentExpecation)
}
function PesterContainExactlyFailureMessage($file, $contentExpecation) {
return "Expected: file ${file} to contain exactly {$contentExpecation}"
}
func... |
PowerShellCorpus/Github/Seix_Rep/DWS/UF1/Web 0 - Peticio/Solucion/packages/jQuery.2.1.1/Tools/uninstall.ps1 | uninstall.ps1 | param($installPath, $toolsPath, $package, $project)
. (Join-Path $toolsPath common.ps1)
# Determine the file paths
$projectIntelliSenseFilePath = Join-Path $projectScriptsFolderPath $intelliSenseFileName
$origIntelliSenseFilePath = Join-Path $toolsPath $intelliSenseFileName
if (Test-Path $projectIntelliSense... |
PowerShellCorpus/Github/Seix_Rep/DWS/UF1/Web 0 - Peticio/Solucion/packages/jQuery.2.1.1/Tools/install.ps1 | install.ps1 | param($installPath, $toolsPath, $package, $project)
. (Join-Path $toolsPath common.ps1)
# VS 11 and above supports the new intellisense JS files
$vsVersion = [System.Version]::Parse($dte.Version)
$supportsJsIntelliSenseFile = $vsVersion.Major -ge 11
if (-not $supportsJsIntelliSenseFile) {
$displayVersio... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.