Skip to content
This repository has been archived by the owner on May 15, 2018. It is now read-only.

Commit

Permalink
Describing Get-SingleDscOperation
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtWDrahn committed Nov 10, 2014
1 parent 6942b2b commit 8e0a8f6
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions Tooling/cDscDiagnostics/cDscDiagnostics.psm1.Tests.ps1
Expand Up @@ -268,6 +268,50 @@ InModuleScope cDscDiagnostics {
Clear-DscDiagnosticsCache
}
}

Describe 'Get-SingleDscOperation' {
Context 'Get-AllGroupedDscEvents is empty' {
Mock -ModuleName cDscDiagnostics Get-AllGroupedDscEvents {}

$result = Get-SingleDscOperation;

It 'should return empty' {
$result | Should BeNullorEmpty
}
}

Context 'JobId is Passed but its not found' {
Mock -ModuleName cDscDiagnostics Log {}
Mock -ModuleName cDscDiagnostics Get-AllGroupedDscEvents {@{Name = "NOJOBID"}}
$result = Get-SingleDscOperation -JobId 3BBB79B7-BD46-424C-9718-983C8C76D37E

It 'should return empty' {
$result | Should BeNullorEmpty
}
}

Context 'JobId is passed and found' {
Mock -ModuleName cDscDiagnostics Log {}
Mock -ModuleName cDscDiagnostics Get-AllGroupedDscEvents {
return New-Object PSObject -Property @{
Name = New-Object PSObject -Property @{
Guid = "3bbb79b7-bd46-424c-9718-983c8c76d37e"
}

Count = 1
}
}

Mock -ModuleName cDscDiagnostics Split-SingleDscGroupedRecord { $true }

$result = Get-SingleDscOperation -JobId 3BBB79B7-BD46-424C-9718-983C8C76D37E

It 'should have called Get-SingleDscOperation' {
Assert-MockCalled Split-SingleDscGroupedRecord -ModuleName cDscDiagnostics -Times 1
$result | Should Be $true
}
}
}
}

Describe "Get-cDscOperation" {
Expand Down

0 comments on commit 8e0a8f6

Please sign in to comment.