tests/functions/Get-D365CeODataEntityData.Tests.ps1
Describe "Get-D365CeODataEntityData 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-D365CeODataEntityData).ParameterSets.Name | Should -Be 'Default', 'NextLink' } It 'Should have the expected parameter EntityName' { $parameter = (Get-Command Get-D365CeODataEntityData).Parameters['EntityName'] $parameter.Name | Should -Be 'EntityName' $parameter.ParameterType.ToString() | Should -Be System.String $parameter.IsDynamic | Should -Be $False $parameter.ParameterSets.Keys | Should -Be 'NextLink', 'Default' $parameter.ParameterSets.Keys | Should -Contain 'NextLink' $parameter.ParameterSets['NextLink'].IsMandatory | Should -Be $True $parameter.ParameterSets['NextLink'].Position | Should -Be -2147483648 $parameter.ParameterSets['NextLink'].ValueFromPipeline | Should -Be $False $parameter.ParameterSets['NextLink'].ValueFromPipelineByPropertyName | Should -Be $False $parameter.ParameterSets['NextLink'].ValueFromRemainingArguments | Should -Be $False $parameter.ParameterSets.Keys | Should -Contain 'Default' $parameter.ParameterSets['Default'].IsMandatory | Should -Be $True $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 ODataQuery' { $parameter = (Get-Command Get-D365CeODataEntityData).Parameters['ODataQuery'] $parameter.Name | Should -Be 'ODataQuery' $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 Charset' { $parameter = (Get-Command Get-D365CeODataEntityData).Parameters['Charset'] $parameter.Name | Should -Be 'Charset' $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 Tenant' { $parameter = (Get-Command Get-D365CeODataEntityData).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-D365CeODataEntityData).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 ClientId' { $parameter = (Get-Command Get-D365CeODataEntityData).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-D365CeODataEntityData).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 FullODataMeta' { $parameter = (Get-Command Get-D365CeODataEntityData).Parameters['FullODataMeta'] $parameter.Name | Should -Be 'FullODataMeta' $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 TraverseNextLink' { $parameter = (Get-Command Get-D365CeODataEntityData).Parameters['TraverseNextLink'] $parameter.Name | Should -Be 'TraverseNextLink' $parameter.ParameterType.ToString() | Should -Be System.Management.Automation.SwitchParameter $parameter.IsDynamic | Should -Be $False $parameter.ParameterSets.Keys | Should -Be 'NextLink' $parameter.ParameterSets.Keys | Should -Contain 'NextLink' $parameter.ParameterSets['NextLink'].IsMandatory | Should -Be $True $parameter.ParameterSets['NextLink'].Position | Should -Be -2147483648 $parameter.ParameterSets['NextLink'].ValueFromPipeline | Should -Be $False $parameter.ParameterSets['NextLink'].ValueFromPipelineByPropertyName | Should -Be $False $parameter.ParameterSets['NextLink'].ValueFromRemainingArguments | Should -Be $False } It 'Should have the expected parameter ThrottleSeed' { $parameter = (Get-Command Get-D365CeODataEntityData).Parameters['ThrottleSeed'] $parameter.Name | Should -Be 'ThrottleSeed' $parameter.ParameterType.ToString() | Should -Be System.Int32 $parameter.IsDynamic | Should -Be $False $parameter.ParameterSets.Keys | Should -Be 'NextLink' $parameter.ParameterSets.Keys | Should -Contain 'NextLink' $parameter.ParameterSets['NextLink'].IsMandatory | Should -Be $False $parameter.ParameterSets['NextLink'].Position | Should -Be -2147483648 $parameter.ParameterSets['NextLink'].ValueFromPipeline | Should -Be $False $parameter.ParameterSets['NextLink'].ValueFromPipelineByPropertyName | Should -Be $False $parameter.ParameterSets['NextLink'].ValueFromRemainingArguments | Should -Be $False } It 'Should have the expected parameter EnableException' { $parameter = (Get-Command Get-D365CeODataEntityData).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-D365CeODataEntityData).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 OutputAsJson' { $parameter = (Get-Command Get-D365CeODataEntityData).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 -EntityName Default -EntityName -ODataQuery -Charset -Tenant -URL -ClientId -ClientSecret -FullODataMeta -EnableException -RawOutput -OutputAsJson #> } Describe "Testing parameterset NextLink" { <# NextLink -EntityName -TraverseNextLink NextLink -EntityName -ODataQuery -Charset -Tenant -URL -ClientId -ClientSecret -FullODataMeta -TraverseNextLink -ThrottleSeed -EnableException -RawOutput -OutputAsJson #> } } |