forked from microsoft/Microsoft365DSC
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
112 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,12 +36,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { | |
Mock -CommandName Set-ExternalInOutlook -MockWith { | ||
} | ||
|
||
Mock -CommandName New-ExternalInOutlook -MockWith { | ||
} | ||
|
||
Mock -CommandName Remove-ExternalInOutlook -MockWith { | ||
} | ||
|
||
Mock -CommandName New-M365DSCConnection -MockWith { | ||
return "Credentials" | ||
} | ||
|
@@ -50,69 +44,22 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { | |
Mock -CommandName Write-Host -MockWith { | ||
} | ||
$Script:exportedInstances =$null | ||
$Script:ExportMode = $false<AssignmentMock> | ||
$Script:ExportMode = $false | ||
} | ||
# Test contexts | ||
Context -Name "The EXOExternalInOutlook should exist but it DOES NOT" -Fixture { | ||
BeforeAll { | ||
$testParams = @{ | ||
<TargetResourceFakeValues> Ensure = "Present" | ||
Credential = $Credential; | ||
} | ||
|
||
Mock -CommandName Get-ExternalInOutlook -MockWith { | ||
return $null | ||
} | ||
} | ||
It 'Should return Values from the Get method' { | ||
(Get-TargetResource @testParams).Ensure | Should -Be 'Absent' | ||
} | ||
It 'Should return false from the Test method' { | ||
Test-TargetResource @testParams | Should -Be $false | ||
} | ||
It 'Should Create the group from the Set method' { | ||
Set-TargetResource @testParams | ||
Should -Invoke -CommandName New-ExternalInOutlook -Exactly 1 | ||
} | ||
} | ||
|
||
Context -Name "The EXOExternalInOutlook exists but it SHOULD NOT" -Fixture { | ||
BeforeAll { | ||
$testParams = @{ | ||
<TargetResourceFakeValues> Ensure = 'Absent' | ||
Credential = $Credential; | ||
} | ||
|
||
Mock -CommandName Get-ExternalInOutlook -MockWith { | ||
return @{ | ||
|
||
} | ||
} | ||
} | ||
|
||
It 'Should return Values from the Get method' { | ||
(Get-TargetResource @testParams).Ensure | Should -Be 'Present' | ||
} | ||
|
||
It 'Should return true from the Test method' { | ||
Test-TargetResource @testParams | Should -Be $false | ||
} | ||
|
||
It 'Should Remove the group from the Set method' { | ||
Set-TargetResource @testParams | ||
Should -Invoke -CommandName Remove-ExternalInOutlook -Exactly 1 | ||
} | ||
} | ||
Context -Name "The EXOExternalInOutlook Exists and Values are already in the desired state" -Fixture { | ||
BeforeAll { | ||
$testParams = @{ | ||
<TargetResourceFakeValues> Ensure = 'Present' | ||
identity = "ExternalInOutlook" | ||
AllowList = @("[email protected]") | ||
Ensure = 'Present' | ||
Credential = $Credential; | ||
} | ||
|
||
Mock -CommandName Get-ExternalInOutlook -MockWith { | ||
return @{ | ||
|
||
AllowList = @("[email protected]") | ||
} | ||
} | ||
} | ||
|
@@ -126,12 +73,16 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { | |
Context -Name "The EXOExternalInOutlook exists and values are NOT in the desired state" -Fixture { | ||
BeforeAll { | ||
$testParams = @{ | ||
<TargetResourceFakeValues> Ensure = 'Present' | ||
identity = "ExternalInOutlook" | ||
AllowList = @("[email protected]","[email protected]") | ||
Ensure = 'Present' | ||
Credential = $Credential; | ||
} | ||
|
||
Mock -CommandName Get-ExternalInOutlook -MockWith { | ||
return @{ | ||
identity = "ExternalInOutlook" | ||
AllowList = @("[email protected]") | ||
} | ||
} | ||
} | ||
|
@@ -154,13 +105,15 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { | |
BeforeAll { | ||
$Global:CurrentModeIsExport = $true | ||
$Global:PartialExportFileName = "$(New-Guid).partial.ps1" | ||
|
||
$testParams = @{ | ||
Credential = $Credential | ||
} | ||
|
||
Mock -CommandName Get-ExternalInOutlook -MockWith { | ||
return @{ | ||
|
||
identity = "ExternalInOutlook" | ||
AllowList = @("[email protected]","[email protected]") | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters