Skip to content

Commit

Permalink
Increase code coverage of BCS service app resource tests
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianFarnhill committed Sep 27, 2015
1 parent 4a9cb6f commit beeaf95
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Describe "xSPBCSServiceApp" {

Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue

Context "When no service application exists in the current farm" {
Context "When no service applications exist in the current farm" {

Mock Get-SPServiceApplication { return $null }
Mock New-SPBusinessDataCatalogServiceApplication { }
Expand All @@ -54,6 +54,19 @@ Describe "xSPBCSServiceApp" {
}
}

Context "When service applications exist in the current farm but the specific BCS app does not" {

Mock Get-SPServiceApplication { return @(@{
TypeName = "Some other service app type"
}) }

It "returns null from the Get method" {
Get-TargetResource @testParams | Should BeNullOrEmpty
Assert-MockCalled Get-SPServiceApplication -ParameterFilter { $Name -eq $testParams.Name }
}

}

Context "When a service application exists and is configured correctly" {
Mock Get-SPServiceApplication {
return @(@{
Expand Down

0 comments on commit beeaf95

Please sign in to comment.