Skip to content

Commit

Permalink
Fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ykuijs committed Jun 8, 2021
1 parent c6b0fac commit f6dbc53
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ try
Invoke-Command -ScriptBlock $Global:SPDscHelper.InitializeScript -NoNewScope

# Initialize tests
Import-Module -Name (Join-Path -Path $PSScriptRoot `
-ChildPath "..\..\..\output\SharePointDsc\$ModuleVersion\Modules\SharePointDsc.Search\SPSearchServiceApp.psm1" `
Import-Module -Name (Join-Path -Path (Get-Module SharePointDsc -ListAvailable).ModuleBase `
-ChildPath "Modules\SharePointDsc.Search\SPSearchServiceApp.psm1" `
-Resolve)

$getTypeFullName = "Microsoft.Office.Server.Search.Administration.SearchServiceApplication"
Expand Down
28 changes: 14 additions & 14 deletions tests/Unit/UnitTestHelper.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function New-SPDscUnitTestHelper
$describeHeader += "[SP Build: $spBuild] "

$repoRoot = Join-Path -Path $PSScriptRoot -ChildPath "..\..\" -Resolve
$moduleRoot = Join-Path -Path $repoRoot -ChildPath "output\SharePointDsc\$ModuleVersion"
$moduleRoot = (Get-Module SharePointDsc -ListAvailable).ModuleBase

$initScript = @"
Set-StrictMode -Version 1
Expand Down Expand Up @@ -142,21 +142,21 @@ function Write-SPDscStubFile
$SPStubContent = ((Get-Command | Where-Object -FilterScript {
$_.Source -eq "Microsoft.SharePoint.PowerShell"
} ) | ForEach-Object -Process {
$signature = $null
$command = $_
$metadata = New-Object -TypeName System.Management.Automation.CommandMetaData `
-ArgumentList $command
$definition = [System.Management.Automation.ProxyCommand]::Create($metadata)
foreach ($line in $definition -split "`n")
{
if ($line.Trim() -eq 'begin')
$signature = $null
$command = $_
$metadata = New-Object -TypeName System.Management.Automation.CommandMetaData `
-ArgumentList $command
$definition = [System.Management.Automation.ProxyCommand]::Create($metadata)
foreach ($line in $definition -split "`n")
{
break
if ($line.Trim() -eq 'begin')
{
break
}
$signature += $line
}
$signature += $line
}
"function $($command.Name) { `n $signature `n } `n"
}) | Out-String
"function $($command.Name) { `n $signature `n } `n"
}) | Out-String

foreach ($line in $SPStubContent.Split([Environment]::NewLine))
{
Expand Down

0 comments on commit f6dbc53

Please sign in to comment.