From ecad4ab499eae963ad1afe96c36def05f449ec65 Mon Sep 17 00:00:00 2001 From: Ben Claussen Date: Thu, 18 Oct 2018 12:55:23 -0400 Subject: [PATCH] Add test for Custom Field parameters --- Tests/Helpers.Tests.ps1 | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Tests/Helpers.Tests.ps1 b/Tests/Helpers.Tests.ps1 index 63587eb..26ea592 100644 --- a/Tests/Helpers.Tests.ps1 +++ b/Tests/Helpers.Tests.ps1 @@ -146,6 +146,24 @@ Describe "Helpers tests" -Tag 'Core', 'Helpers' -Fixture { $URIComponents.Parameters | Should -BeOfType [hashtable] $URIComponents.Parameters['q'] | Should -Be 'mytestquery' } + + It "Should generate custom field parameters" { + $URIComponents = BuildURIComponents -URISegments @('segment1', 'segment2') -ParametersDictionary @{ + 'CustomFields' = @{ + 'PRTG_Id' = 1234 + 'Customer_Id' = 'abc' + } + } + + $URIComponents | Should -BeOfType [hashtable] + $URIComponents.Keys.Count | Should -BeExactly 2 + $URIComponents.Keys | Should -Be @("Segments", "Parameters") + $URIComponents.Segments | Should -Be @("segment1", "segment2") + $URIComponents.Parameters.Count | Should -BeExactly 2 + $URIComponents.Parameters | Should -BeOfType [hashtable] + $URIComponents.Parameters['cf_prtg_id'] | Should -Be '1234' + $URIComponents.Parameters['cf_customer_id'] | Should -Be 'abc' + } } Context -Name "Invoking request tests" -Fixture {