tests/functions/Get-D365ODataPublicEntity.Tests.ps1

Describe "Get-D365ODataPublicEntity Unit Tests" -Tag "Unit" {
    BeforeAll {
        # Place here all things needed to prepare for the tests
    }
    AfterAll {
        # Here is where all the cleanup tasks go
    }
    
    Describe "Ensuring unchanged command signature" {
        It "should have the expected parameter sets" {
            (Get-Command Get-D365ODataPublicEntity).ParameterSets.Name | Should -Be 'Default', 'NameContains', 'Query'
        }
        
        It 'Should have the expected parameter EntityName' {
            $parameter = (Get-Command Get-D365ODataPublicEntity).Parameters['EntityName']
            $parameter.Name | Should -Be 'EntityName'
            $parameter.ParameterType.ToString() | Should -Be System.String
            $parameter.IsDynamic | Should -Be $False
            $parameter.ParameterSets.Keys | Should -Be 'Default'
            $parameter.ParameterSets.Keys | Should -Contain 'Default'
            $parameter.ParameterSets['Default'].IsMandatory | Should -Be $False
            $parameter.ParameterSets['Default'].Position | Should -Be -2147483648
            $parameter.ParameterSets['Default'].ValueFromPipeline | Should -Be $False
            $parameter.ParameterSets['Default'].ValueFromPipelineByPropertyName | Should -Be $False
            $parameter.ParameterSets['Default'].ValueFromRemainingArguments | Should -Be $False
        }
        It 'Should have the expected parameter EntityNameContains' {
            $parameter = (Get-Command Get-D365ODataPublicEntity).Parameters['EntityNameContains']
            $parameter.Name | Should -Be 'EntityNameContains'
            $parameter.ParameterType.ToString() | Should -Be System.String
            $parameter.IsDynamic | Should -Be $False
            $parameter.ParameterSets.Keys | Should -Be 'NameContains'
            $parameter.ParameterSets.Keys | Should -Contain 'NameContains'
            $parameter.ParameterSets['NameContains'].IsMandatory | Should -Be $True
            $parameter.ParameterSets['NameContains'].Position | Should -Be -2147483648
            $parameter.ParameterSets['NameContains'].ValueFromPipeline | Should -Be $False
            $parameter.ParameterSets['NameContains'].ValueFromPipelineByPropertyName | Should -Be $False
            $parameter.ParameterSets['NameContains'].ValueFromRemainingArguments | Should -Be $False
        }
        It 'Should have the expected parameter ODataQuery' {
            $parameter = (Get-Command Get-D365ODataPublicEntity).Parameters['ODataQuery']
            $parameter.Name | Should -Be 'ODataQuery'
            $parameter.ParameterType.ToString() | Should -Be System.String
            $parameter.IsDynamic | Should -Be $False
            $parameter.ParameterSets.Keys | Should -Be 'Query', 'NameContains', 'Default'
            $parameter.ParameterSets.Keys | Should -Contain 'Query'
            $parameter.ParameterSets['Query'].IsMandatory | Should -Be $True
            $parameter.ParameterSets['Query'].Position | Should -Be -2147483648
            $parameter.ParameterSets['Query'].ValueFromPipeline | Should -Be $False
            $parameter.ParameterSets['Query'].ValueFromPipelineByPropertyName | Should -Be $False
            $parameter.ParameterSets['Query'].ValueFromRemainingArguments | Should -Be $False
            $parameter.ParameterSets.Keys | Should -Contain 'NameContains'
            $parameter.ParameterSets['NameContains'].IsMandatory | Should -Be $False
            $parameter.ParameterSets['NameContains'].Position | Should -Be -2147483648
            $parameter.ParameterSets['NameContains'].ValueFromPipeline | Should -Be $False
            $parameter.ParameterSets['NameContains'].ValueFromPipelineByPropertyName | Should -Be $False
            $parameter.ParameterSets['NameContains'].ValueFromRemainingArguments | Should -Be $False
            $parameter.ParameterSets.Keys | Should -Contain 'Default'
            $parameter.ParameterSets['Default'].IsMandatory | Should -Be $False
            $parameter.ParameterSets['Default'].Position | Should -Be -2147483648
            $parameter.ParameterSets['Default'].ValueFromPipeline | Should -Be $False
            $parameter.ParameterSets['Default'].ValueFromPipelineByPropertyName | Should -Be $False
            $parameter.ParameterSets['Default'].ValueFromRemainingArguments | Should -Be $False
        }
        It 'Should have the expected parameter Tenant' {
            $parameter = (Get-Command Get-D365ODataPublicEntity).Parameters['Tenant']
            $parameter.Name | Should -Be 'Tenant'
            $parameter.ParameterType.ToString() | Should -Be System.String
            $parameter.IsDynamic | Should -Be $False
            $parameter.ParameterSets.Keys | Should -Be '__AllParameterSets'
            $parameter.ParameterSets.Keys | Should -Contain '__AllParameterSets'
            $parameter.ParameterSets['__AllParameterSets'].IsMandatory | Should -Be $False
            $parameter.ParameterSets['__AllParameterSets'].Position | Should -Be -2147483648
            $parameter.ParameterSets['__AllParameterSets'].ValueFromPipeline | Should -Be $False
            $parameter.ParameterSets['__AllParameterSets'].ValueFromPipelineByPropertyName | Should -Be $False
            $parameter.ParameterSets['__AllParameterSets'].ValueFromRemainingArguments | Should -Be $False
        }
        It 'Should have the expected parameter Url' {
            $parameter = (Get-Command Get-D365ODataPublicEntity).Parameters['Url']
            $parameter.Name | Should -Be 'Url'
            $parameter.ParameterType.ToString() | Should -Be System.String
            $parameter.IsDynamic | Should -Be $False
            $parameter.ParameterSets.Keys | Should -Be '__AllParameterSets'
            $parameter.ParameterSets.Keys | Should -Contain '__AllParameterSets'
            $parameter.ParameterSets['__AllParameterSets'].IsMandatory | Should -Be $False
            $parameter.ParameterSets['__AllParameterSets'].Position | Should -Be -2147483648
            $parameter.ParameterSets['__AllParameterSets'].ValueFromPipeline | Should -Be $False
            $parameter.ParameterSets['__AllParameterSets'].ValueFromPipelineByPropertyName | Should -Be $False
            $parameter.ParameterSets['__AllParameterSets'].ValueFromRemainingArguments | Should -Be $False
        }
        It 'Should have the expected parameter SystemUrl' {
            $parameter = (Get-Command Get-D365ODataPublicEntity).Parameters['SystemUrl']
            $parameter.Name | Should -Be 'SystemUrl'
            $parameter.ParameterType.ToString() | Should -Be System.String
            $parameter.IsDynamic | Should -Be $False
            $parameter.ParameterSets.Keys | Should -Be '__AllParameterSets'
            $parameter.ParameterSets.Keys | Should -Contain '__AllParameterSets'
            $parameter.ParameterSets['__AllParameterSets'].IsMandatory | Should -Be $False
            $parameter.ParameterSets['__AllParameterSets'].Position | Should -Be -2147483648
            $parameter.ParameterSets['__AllParameterSets'].ValueFromPipeline | Should -Be $False
            $parameter.ParameterSets['__AllParameterSets'].ValueFromPipelineByPropertyName | Should -Be $False
            $parameter.ParameterSets['__AllParameterSets'].ValueFromRemainingArguments | Should -Be $False
        }
        It 'Should have the expected parameter ClientId' {
            $parameter = (Get-Command Get-D365ODataPublicEntity).Parameters['ClientId']
            $parameter.Name | Should -Be 'ClientId'
            $parameter.ParameterType.ToString() | Should -Be System.String
            $parameter.IsDynamic | Should -Be $False
            $parameter.ParameterSets.Keys | Should -Be '__AllParameterSets'
            $parameter.ParameterSets.Keys | Should -Contain '__AllParameterSets'
            $parameter.ParameterSets['__AllParameterSets'].IsMandatory | Should -Be $False
            $parameter.ParameterSets['__AllParameterSets'].Position | Should -Be -2147483648
            $parameter.ParameterSets['__AllParameterSets'].ValueFromPipeline | Should -Be $False
            $parameter.ParameterSets['__AllParameterSets'].ValueFromPipelineByPropertyName | Should -Be $False
            $parameter.ParameterSets['__AllParameterSets'].ValueFromRemainingArguments | Should -Be $False
        }
        It 'Should have the expected parameter ClientSecret' {
            $parameter = (Get-Command Get-D365ODataPublicEntity).Parameters['ClientSecret']
            $parameter.Name | Should -Be 'ClientSecret'
            $parameter.ParameterType.ToString() | Should -Be System.String
            $parameter.IsDynamic | Should -Be $False
            $parameter.ParameterSets.Keys | Should -Be '__AllParameterSets'
            $parameter.ParameterSets.Keys | Should -Contain '__AllParameterSets'
            $parameter.ParameterSets['__AllParameterSets'].IsMandatory | Should -Be $False
            $parameter.ParameterSets['__AllParameterSets'].Position | Should -Be -2147483648
            $parameter.ParameterSets['__AllParameterSets'].ValueFromPipeline | Should -Be $False
            $parameter.ParameterSets['__AllParameterSets'].ValueFromPipelineByPropertyName | Should -Be $False
            $parameter.ParameterSets['__AllParameterSets'].ValueFromRemainingArguments | Should -Be $False
        }
        It 'Should have the expected parameter Token' {
            $parameter = (Get-Command Get-D365ODataPublicEntity).Parameters['Token']
            $parameter.Name | Should -Be 'Token'
            $parameter.ParameterType.ToString() | Should -Be System.String
            $parameter.IsDynamic | Should -Be $False
            $parameter.ParameterSets.Keys | Should -Be '__AllParameterSets'
            $parameter.ParameterSets.Keys | Should -Contain '__AllParameterSets'
            $parameter.ParameterSets['__AllParameterSets'].IsMandatory | Should -Be $False
            $parameter.ParameterSets['__AllParameterSets'].Position | Should -Be -2147483648
            $parameter.ParameterSets['__AllParameterSets'].ValueFromPipeline | Should -Be $False
            $parameter.ParameterSets['__AllParameterSets'].ValueFromPipelineByPropertyName | Should -Be $False
            $parameter.ParameterSets['__AllParameterSets'].ValueFromRemainingArguments | Should -Be $False
        }
        It 'Should have the expected parameter EnableException' {
            $parameter = (Get-Command Get-D365ODataPublicEntity).Parameters['EnableException']
            $parameter.Name | Should -Be 'EnableException'
            $parameter.ParameterType.ToString() | Should -Be System.Management.Automation.SwitchParameter
            $parameter.IsDynamic | Should -Be $False
            $parameter.ParameterSets.Keys | Should -Be '__AllParameterSets'
            $parameter.ParameterSets.Keys | Should -Contain '__AllParameterSets'
            $parameter.ParameterSets['__AllParameterSets'].IsMandatory | Should -Be $False
            $parameter.ParameterSets['__AllParameterSets'].Position | Should -Be -2147483648
            $parameter.ParameterSets['__AllParameterSets'].ValueFromPipeline | Should -Be $False
            $parameter.ParameterSets['__AllParameterSets'].ValueFromPipelineByPropertyName | Should -Be $False
            $parameter.ParameterSets['__AllParameterSets'].ValueFromRemainingArguments | Should -Be $False
        }
        It 'Should have the expected parameter RawOutput' {
            $parameter = (Get-Command Get-D365ODataPublicEntity).Parameters['RawOutput']
            $parameter.Name | Should -Be 'RawOutput'
            $parameter.ParameterType.ToString() | Should -Be System.Management.Automation.SwitchParameter
            $parameter.IsDynamic | Should -Be $False
            $parameter.ParameterSets.Keys | Should -Be '__AllParameterSets'
            $parameter.ParameterSets.Keys | Should -Contain '__AllParameterSets'
            $parameter.ParameterSets['__AllParameterSets'].IsMandatory | Should -Be $False
            $parameter.ParameterSets['__AllParameterSets'].Position | Should -Be -2147483648
            $parameter.ParameterSets['__AllParameterSets'].ValueFromPipeline | Should -Be $False
            $parameter.ParameterSets['__AllParameterSets'].ValueFromPipelineByPropertyName | Should -Be $False
            $parameter.ParameterSets['__AllParameterSets'].ValueFromRemainingArguments | Should -Be $False
        }
        It 'Should have the expected parameter OutNamesOnly' {
            $parameter = (Get-Command Get-D365ODataPublicEntity).Parameters['OutNamesOnly']
            $parameter.Name | Should -Be 'OutNamesOnly'
            $parameter.ParameterType.ToString() | Should -Be System.Management.Automation.SwitchParameter
            $parameter.IsDynamic | Should -Be $False
            $parameter.ParameterSets.Keys | Should -Be '__AllParameterSets'
            $parameter.ParameterSets.Keys | Should -Contain '__AllParameterSets'
            $parameter.ParameterSets['__AllParameterSets'].IsMandatory | Should -Be $False
            $parameter.ParameterSets['__AllParameterSets'].Position | Should -Be -2147483648
            $parameter.ParameterSets['__AllParameterSets'].ValueFromPipeline | Should -Be $False
            $parameter.ParameterSets['__AllParameterSets'].ValueFromPipelineByPropertyName | Should -Be $False
            $parameter.ParameterSets['__AllParameterSets'].ValueFromRemainingArguments | Should -Be $False
        }
        It 'Should have the expected parameter OutputAsJson' {
            $parameter = (Get-Command Get-D365ODataPublicEntity).Parameters['OutputAsJson']
            $parameter.Name | Should -Be 'OutputAsJson'
            $parameter.ParameterType.ToString() | Should -Be System.Management.Automation.SwitchParameter
            $parameter.IsDynamic | Should -Be $False
            $parameter.ParameterSets.Keys | Should -Be '__AllParameterSets'
            $parameter.ParameterSets.Keys | Should -Contain '__AllParameterSets'
            $parameter.ParameterSets['__AllParameterSets'].IsMandatory | Should -Be $False
            $parameter.ParameterSets['__AllParameterSets'].Position | Should -Be -2147483648
            $parameter.ParameterSets['__AllParameterSets'].ValueFromPipeline | Should -Be $False
            $parameter.ParameterSets['__AllParameterSets'].ValueFromPipelineByPropertyName | Should -Be $False
            $parameter.ParameterSets['__AllParameterSets'].ValueFromRemainingArguments | Should -Be $False
        }
    }
    
    Describe "Testing parameterset Default" {
        <#
        Default -
        Default -EntityName -ODataQuery -Tenant -Url -SystemUrl -ClientId -ClientSecret -Token -EnableException -RawOutput -OutNamesOnly -OutputAsJson
        #>

    }
     Describe "Testing parameterset NameContains" {
        <#
        NameContains -EntityNameContains
        NameContains -EntityNameContains -ODataQuery -Tenant -Url -SystemUrl -ClientId -ClientSecret -Token -EnableException -RawOutput -OutNamesOnly -OutputAsJson
        #>

    }
     Describe "Testing parameterset Query" {
        <#
        Query -ODataQuery
        Query -ODataQuery -Tenant -Url -SystemUrl -ClientId -ClientSecret -Token -EnableException -RawOutput -OutNamesOnly -OutputAsJson
        #>

    }

}