tests/PSTS.core.Tests.ps1

if ($PSScriptRoot -eq $null) {
    $PSScriptRoot = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition
}

. "$PSScriptRoot\helper.ps1"

describe 'Get-PSTSProcessTemplate' {


    # Arrange
    $data = @([Process]::new(); [Process]::new())

    $expectedResult = New-Object -TypeName "PSObject"


    $expectedResult | Add-Member -MemberType NoteProperty "Count" -Value $data.Count
    $expectedResult | Add-Member -MemberType NoteProperty "value" -Value $data

    arrange -result $expectedResult

    # Act
    $result = Get-PSTSProcessTemplate

    #Assert
    It "Uses the mock" {
        Assert-VerifiableMock
    }

    it "should return $($expectedResult.value)" {
        $result.Count | should -Be $expectedResult.value.Count
    }
}

describe 'Add-PSTSProject' {


    # Arrange
    $expectedResult =  [Project]::new()
    $expectedResult.name = "fakeProject"

    arrange -result $expectedResult

    # Act
    $result = Add-PSTSProject -name "fakeProject" -description "fake desc" -processTemplateId "fakeProcessTemplateId"

    #Assert
    It "Uses the mock" {
        Assert-VerifiableMock
    }

    it "should return $($expectedResult.name)" {
        $result.name | should -Be $expectedResult.name
    }

}

describe 'Get-PSTSProject' {


    # Arrange
    $data = @([Project]::new(); [Project]::new())

    $expectedResult = New-Object -TypeName "PSObject"


    $expectedResult | Add-Member -MemberType NoteProperty "Count" -Value $data.Count
    $expectedResult | Add-Member -MemberType NoteProperty "value" -Value $data

    arrange -result $expectedResult

    # Act
    $result = Get-PSTSProject

    #Assert
    It "Uses the mock" {
        Assert-VerifiableMock
    }

    it "should return $($expectedResult.value)" {
        $result.Count | should -Be $expectedResult.value.Count
    }
}