tests/PSTS.serviceEndpoint.Tests.ps1
if ($PSScriptRoot -eq $null) { $PSScriptRoot = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition } . "$PSScriptRoot\helper.ps1" describe 'Get-PSTSAgentQueue' { # Arrange $expectedResult = @([AgentQueue]::new(); [AgentQueue]::new()) arrange -result $expectedResult # Act $result = Get-PSTSAgentQueue -project fakeProject #Assert It "Uses the mock" { Assert-VerifiableMock } it "should return $(@([AgentQueue]::new(); [AgentQueue]::new()))" { $result | should -Be $expectedResult.value } } describe 'Get-PSTSServiceEndpoint' { # Arrange $expectedResult = @([ServiceEndpoint]::new(); [ServiceEndpoint]::new()) arrange -result $expectedResult # Act $result = Get-PSTSServiceEndpoint -project fakeProject #Assert It "Uses the mock" { Assert-VerifiableMock } it "should return $(@([ServiceEndpoint]::new(); [ServiceEndpoint]::new()))" { $result | should -Be $expectedResult.value } } describe 'Add-PSTSServiceEndPointAzurerm' { # Arrange $expectedResult = [ServiceEndpoint]::new() $expectedResult.name = "fakeName" arrange -result $expectedResult # Act $result = Add-PSTSServiceEndPointAzurerm -project fakeProject -servicePrincipaleId fakeSpId ` -servicePrincipaleKey fakeSpKey -subscriptionId fakeSubId -subscriptionName fakeSubName ` -tenantId fakeTenantId -name fakeName #Assert It "Uses the mock" { Assert-VerifiableMock } it "should return $([ServiceEndpoint]::new())" { $result.name | should -Be $expectedResult.name } } describe 'Add-PSTSServiceEndPointGit' { # Arrange $expectedResult = [ServiceEndpoint]::new() $expectedResult.name = "fakeName" arrange -result $expectedResult # Act $result = Add-PSTSServiceEndPointGit -project fakeProject -username fakeUserName ` -password fakePassword -url fakeUrl -name fakeName #Assert It "Uses the mock" { Assert-VerifiableMock } it "should return $([ServiceEndpoint]::new())" { $result.name | should -Be $expectedResult.name } } |