1 Import-Module Pester 2 3 BeforeAll { 4 . $PSScriptRoot/../job-matrix-functions.ps1 5 6 $matrixConfig = @" 7 { 8 "displayNames": { 9 "--enableFoo": "withfoo" 10 }, 11 "matrix": { 12 "operatingSystem": [ 13 "windows-2019", 14 "ubuntu-18.04", 15 "macOS-10.15" 16 ], 17 "framework": [ 18 "net461", 19 "netcoreapp2.1" 20 ], 21 "additionalArguments": [ 22 "", 23 "--enableFoo" 24 ] 25 }, 26 "include": [ 27 { 28 "operatingSystem": "windows-2019", 29 "framework": ["net461", "netcoreapp2.1", "net50"], 30 "additionalArguments": "--enableWindowsFoo" 31 } 32 ], 33 "exclude": [ 34 { 35 "operatingSystem": "windows-2019", 36 "framework": "net461" 37 }, 38 { 39 "operatingSystem": "macOS-10.15", 40 "framework": "netcoreapp2.1" 41 }, 42 { 43 "operatingSystem": ["macOS-10.15", "ubuntu-18.04"], 44 "additionalArguments": "--enableFoo" 45 } 46 ] 47 } 48 "@ 49 } 50 51 Describe "Matrix-Lookup" -Tag "lookup" { 52 It "Should navigate a 2d matrix: <row> <col>" -TestCases @( 53 @{ row = 0; col = 0; expected = 1 }, 54 @{ row = 0; col = 1; expected = 2 }, 55 @{ row = 1; col = 0; expected = 3 }, 56 @{ row = 1; col = 1; expected = 4 } 57 ) { 58 $dimensions = @(2, 2) 59 $matrix = @( 60 1, 2, 3, 4 61 ) 62 GetNdMatrixElement @($row, $col) $matrix $dimensions | Should -Be $expected 63 } 64 65 It "Should navigate a 3d matrix: <z> <row> <col>" -TestCases @( 66 @{ z = 0; row = 0; col = 0; expected = 1 } 67 @{ z = 0; row = 0; col = 1; expected = 2 } 68 @{ z = 0; row = 1; col = 0; expected = 3 } 69 @{ z = 0; row = 1; col = 1; expected = 4 } 70 @{ z = 1; row = 0; col = 0; expected = 5 } 71 @{ z = 1; row = 0; col = 1; expected = 6 } 72 @{ z = 1; row = 1; col = 0; expected = 7 } 73 @{ z = 1; row = 1; col = 1; expected = 8 } 74 ) { 75 $dimensions = @(2, 2, 2) 76 $matrix = @( 77 1, 2, 3, 4, 5, 6, 7, 8 78 ) 79 GetNdMatrixElement @($z, $row, $col) $matrix $dimensions | Should -Be $expected 80 } 81 82 It "Should navigate a 4d matrix: <t> <z> <row> <col>" -TestCases @( 83 @{ t = 0; z = 0; row = 0; col = 0; expected = 1 } 84 @{ t = 0; z = 0; row = 0; col = 1; expected = 2 } 85 @{ t = 0; z = 0; row = 1; col = 0; expected = 3 } 86 @{ t = 0; z = 0; row = 1; col = 1; expected = 4 } 87 @{ t = 0; z = 1; row = 0; col = 0; expected = 5 } 88 @{ t = 0; z = 1; row = 0; col = 1; expected = 6 } 89 @{ t = 0; z = 1; row = 1; col = 0; expected = 7 } 90 @{ t = 0; z = 1; row = 1; col = 1; expected = 8 } 91 @{ t = 1; z = 0; row = 0; col = 0; expected = 9 } 92 @{ t = 1; z = 0; row = 0; col = 1; expected = 10 } 93 @{ t = 1; z = 0; row = 1; col = 0; expected = 11 } 94 @{ t = 1; z = 0; row = 1; col = 1; expected = 12 } 95 @{ t = 1; z = 1; row = 0; col = 0; expected = 13 } 96 @{ t = 1; z = 1; row = 0; col = 1; expected = 14 } 97 @{ t = 1; z = 1; row = 1; col = 0; expected = 15 } 98 @{ t = 1; z = 1; row = 1; col = 1; expected = 16 } 99 ) { 100 $dimensions = @(2, 2, 2, 2) 101 $matrix = @( 102 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 103 ) 104 GetNdMatrixElement @($t, $z, $row, $col) $matrix $dimensions | Should -Be $expected 105 } 106 107 It "Should navigate a 4d matrix: <t> <z> <row> <col>" -TestCases @( 108 @{ t = 0; z = 0; row = 0; col = 0; expected = 1 } 109 @{ t = 0; z = 0; row = 0; col = 1; expected = 2 } 110 @{ t = 0; z = 0; row = 0; col = 2; expected = 3 } 111 @{ t = 0; z = 0; row = 0; col = 3; expected = 4 } 112 113 @{ t = 0; z = 0; row = 1; col = 0; expected = 5 } 114 @{ t = 0; z = 0; row = 1; col = 1; expected = 6 } 115 @{ t = 0; z = 0; row = 1; col = 2; expected = 7 } 116 @{ t = 0; z = 0; row = 1; col = 3; expected = 8 } 117 118 @{ t = 0; z = 1; row = 0; col = 0; expected = 9 } 119 @{ t = 0; z = 1; row = 0; col = 1; expected = 10 } 120 @{ t = 0; z = 1; row = 0; col = 2; expected = 11 } 121 @{ t = 0; z = 1; row = 0; col = 3; expected = 12 } 122 123 @{ t = 0; z = 1; row = 1; col = 0; expected = 13 } 124 @{ t = 0; z = 1; row = 1; col = 1; expected = 14 } 125 @{ t = 0; z = 1; row = 1; col = 2; expected = 15 } 126 @{ t = 0; z = 1; row = 1; col = 3; expected = 16 } 127 ) { 128 $dimensions = @(1, 2, 2, 4) 129 $matrix = @( 130 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 131 ) 132 GetNdMatrixElement @($t, $z, $row, $col) $matrix $dimensions | Should -Be $expected 133 } 134 135 # Skipping since by default wrapping behavior on indexing is disabled. 136 # Keeping here in case we want to enable it. 137 It -Skip "Should handle index wrapping: <row> <col>" -TestCases @( 138 @{ row = 2; col = 2; expected = 1 } 139 @{ row = 2; col = 3; expected = 2 } 140 @{ row = 4; col = 4; expected = 1 } 141 @{ row = 4; col = 5; expected = 2 } 142 ) { 143 $dimensions = @(2, 2) 144 $matrix = @( 145 1, 2, 3, 4 146 ) 147 GetNdMatrixElement @($row, $col) $matrix $dimensions | Should -Be $expected 148 } 149 } 150 151 Describe "Matrix-Reverse-Lookup" -Tag "lookup" { 152 It "Should lookup a 2d matrix index: <index>" -TestCases @( 153 @{ index = 0; expected = @(0,0) } 154 @{ index = 1; expected = @(0,1) } 155 @{ index = 2; expected = @(1,0) } 156 @{ index = 3; expected = @(1,1) } 157 ) { 158 $dimensions = @(2, 2) 159 $matrix = @(1, 2, 3, 4) 160 GetNdMatrixElement $expected $matrix $dimensions | Should -Be $matrix[$index] 161 GetNdMatrixIndex $index $dimensions | Should -Be $expected 162 } 163 164 It "Should lookup a 3d matrix index: <index>" -TestCases @( 165 @{ index = 0; expected = @(0,0,0) } 166 @{ index = 1; expected = @(0,0,1) } 167 @{ index = 2; expected = @(0,1,0) } 168 @{ index = 3; expected = @(0,1,1) } 169 170 @{ index = 4; expected = @(1,0,0) } 171 @{ index = 5; expected = @(1,0,1) } 172 @{ index = 6; expected = @(1,1,0) } 173 @{ index = 7; expected = @(1,1,1) } 174 ) { 175 $dimensions = @(2, 2, 2) 176 $matrix = @(0, 1, 2, 3, 4, 5, 6, 7) 177 GetNdMatrixElement $expected $matrix $dimensions | Should -Be $matrix[$index] 178 GetNdMatrixIndex $index $dimensions | Should -Be $expected 179 } 180 181 It "Should lookup a 3d matrix index: <index>" -TestCases @( 182 @{ index = 0; expected = @(0,0,0) } 183 @{ index = 1; expected = @(0,0,1) } 184 @{ index = 2; expected = @(0,0,2) } 185 186 @{ index = 3; expected = @(0,1,0) } 187 @{ index = 4; expected = @(0,1,1) } 188 @{ index = 5; expected = @(0,1,2) } 189 190 @{ index = 6; expected = @(1,0,0) } 191 @{ index = 7; expected = @(1,0,1) } 192 @{ index = 8; expected = @(1,0,2) } 193 194 @{ index = 9; expected = @(1,1,0) } 195 @{ index = 10; expected = @(1,1,1) } 196 @{ index = 11; expected = @(1,1,2) } 197 ) { 198 $dimensions = @(2, 2, 3) 199 $matrix = @(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) 200 GetNdMatrixElement $expected $matrix $dimensions | Should -Be $matrix[$index] 201 GetNdMatrixIndex $index $dimensions | Should -Be $expected 202 } 203 204 It "Should lookup a 3d matrix index: <index>" -TestCases @( 205 @{ index = 0; expected = @(0,0,0) } 206 @{ index = 1; expected = @(0,0,1) } 207 @{ index = 2; expected = @(0,1,0) } 208 @{ index = 3; expected = @(0,1,1) } 209 210 @{ index = 4; expected = @(1,0,0) } 211 @{ index = 5; expected = @(1,0,1) } 212 @{ index = 6; expected = @(1,1,0) } 213 @{ index = 7; expected = @(1,1,1) } 214 215 @{ index = 8; expected = @(2,0,0) } 216 @{ index = 9; expected = @(2,0,1) } 217 @{ index = 10; expected = @(2,1,0) } 218 @{ index = 11; expected = @(2,1,1) } 219 ) { 220 $dimensions = @(3, 2, 2) 221 $matrix = @(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) 222 GetNdMatrixElement $expected $matrix $dimensions | Should -Be $matrix[$index] 223 GetNdMatrixIndex $index $dimensions | Should -Be $expected 224 } 225 226 It "Should lookup a 4d matrix index: <index>" -TestCases @( 227 @{ index = 0; expected = @(0,0,0,0) } 228 @{ index = 1; expected = @(0,0,0,1) } 229 @{ index = 2; expected = @(0,0,0,2) } 230 @{ index = 3; expected = @(0,0,0,3) } 231 232 @{ index = 4; expected = @(0,0,1,0) } 233 @{ index = 5; expected = @(0,0,1,1) } 234 @{ index = 6; expected = @(0,0,1,2) } 235 @{ index = 7; expected = @(0,0,1,3) } 236 237 @{ index = 8; expected = @(0,1,0,0) } 238 @{ index = 9; expected = @(0,1,0,1) } 239 @{ index = 10; expected = @(0,1,0,2) } 240 @{ index = 11; expected = @(0,1,0,3) } 241 242 @{ index = 12; expected = @(0,1,1,0) } 243 @{ index = 13; expected = @(0,1,1,1) } 244 @{ index = 14; expected = @(0,1,1,2) } 245 @{ index = 15; expected = @(0,1,1,3) } 246 ) { 247 $dimensions = @(1, 2, 2, 4) 248 $matrix = @(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15) 249 GetNdMatrixElement $expected $matrix $dimensions | Should -Be $matrix[$index] 250 GetNdMatrixIndex $index $dimensions | Should -Be $expected 251 } 252 } 253 254 Describe 'Matrix-Set' -Tag "set" { 255 It "Should set a matrix element" -TestCases @( 256 @{ value = "set"; index = @(0,0,0,0); arrayIndex = 0 } 257 @{ value = "ones"; index = @(0,1,1,1); arrayIndex = 13 } 258 ) { 259 $dimensions = @(1, 2, 2, 4) 260 $matrix = @(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15) 261 262 SetNdMatrixElement $value $index $matrix $dimensions 263 $matrix[$arrayIndex] | Should -Be $value 264 } 265 } 266 267 Describe "Platform Matrix Generation" -Tag "generate" { 268 BeforeEach { 269 $matrixConfigForGenerate = @" 270 { 271 "displayNames": { 272 "--enableFoo": "withfoo" 273 }, 274 "matrix": { 275 "operatingSystem": [ 276 "windows-2019", 277 "ubuntu-18.04", 278 "macOS-10.15" 279 ], 280 "framework": [ 281 "net461", 282 "netcoreapp2.1" 283 ], 284 "additionalArguments": [ 285 "", 286 "--enableFoo" 287 ] 288 }, 289 "include": [ 290 { 291 "operatingSystem": "windows-2019", 292 "framework": "net461", 293 "additionalTestArguments": "/p:UseProjectReferenceToAzureClients=true" 294 } 295 ], 296 "exclude": [ 297 { 298 "foo": "bar" 299 }, 300 { 301 "foo2": "bar2" 302 } 303 ] 304 } 305 "@ 306 $generateConfig = GetMatrixConfigFromJson $matrixConfigForGenerate 307 } 308 309 It "Should get matrix dimensions from Nd parameters" { 310 GetMatrixDimensions $generateConfig.matrixParameters | Should -Be 3, 2, 2 311 } 312 313 It "Should use name overrides from displayNames" { 314 $dimensions = GetMatrixDimensions $generateConfig.matrixParameters 315 $matrix = GenerateFullMatrix $generateConfig.matrixParameters $generateconfig.displayNamesLookup 316 317 $element = GetNdMatrixElement @(0, 0, 0) $matrix $dimensions 318 $element.name | Should -Be "windows2019_net461" 319 320 $element = GetNdMatrixElement @(1, 1, 1) $matrix $dimensions 321 $element.name | Should -Be "ubuntu1804_netcoreapp21_withFoo" 322 323 $element = GetNdMatrixElement @(2, 1, 1) $matrix $dimensions 324 $element.name | Should -Be "macOS1015_netcoreapp21_withFoo" 325 } 326 327 It "Should enforce valid display name format" { 328 $generateconfig.displayNamesLookup["net461"] = '123.Some.456.Invalid_format-name$(foo)' 329 $generateconfig.displayNamesLookup["netcoreapp2.1"] = (New-Object string[] 150) -join "a" 330 $dimensions = GetMatrixDimensions $generateConfig.matrixParameters 331 $matrix = GenerateFullMatrix $generateconfig.matrixParameters $generateconfig.displayNamesLookup 332 333 $element = GetNdMatrixElement @(0, 0, 0) $matrix $dimensions 334 $element.name | Should -Be "windows2019_123some456invalid_formatnamefoo" 335 336 $element = GetNdMatrixElement @(1, 1, 1) $matrix $dimensions 337 $element.name.Length | Should -Be 100 338 # The withfoo part of the argument gets cut off at the character limit 339 $element.name | Should -BeLike "ubuntu1804_aaaaaaaaaaaaaaaaa*" 340 } 341 342 343 It "Should initialize an N-dimensional matrix from all parameter permutations" { 344 $dimensions = GetMatrixDimensions $generateConfig.matrixParameters 345 $matrix = GenerateFullMatrix $generateConfig.matrixParameters $generateConfig.displayNamesLookup 346 $matrix.Count | Should -Be 12 347 348 $element = $matrix[0].parameters 349 $element.operatingSystem | Should -Be "windows-2019" 350 $element.framework | Should -Be "net461" 351 $element.additionalArguments | Should -Be "" 352 353 $element = GetNdMatrixElement @(1, 1, 1) $matrix $dimensions 354 $element.parameters.operatingSystem | Should -Be "ubuntu-18.04" 355 $element.parameters.framework | Should -Be "netcoreapp2.1" 356 $element.parameters.additionalArguments | Should -Be "--enableFoo" 357 358 $element = GetNdMatrixElement @(2, 1, 1) $matrix $dimensions 359 $element.parameters.operatingSystem | Should -Be "macOS-10.15" 360 $element.parameters.framework | Should -Be "netcoreapp2.1" 361 $element.parameters.additionalArguments | Should -Be "--enableFoo" 362 } 363 364 It "Should initialize a sparse matrix from an N-dimensional matrix" -TestCases @( 365 @{ i = 0; name = "windows2019_net461"; operatingSystem = "windows-2019"; framework = "net461"; additionalArguments = ""; } 366 @{ i = 1; name = "ubuntu1804_netcoreapp21_withfoo"; operatingSystem = "ubuntu-18.04"; framework = "netcoreapp2.1"; additionalArguments = "--enableFoo"; } 367 @{ i = 2; name = "macOS1015_net461"; operatingSystem = "macOS-10.15"; framework = "net461"; additionalArguments = ""; } 368 ) { 369 $sparseMatrix = GenerateSparseMatrix $generateConfig.matrixParameters $generateConfig.displayNamesLookup 370 $dimensions = GetMatrixDimensions $generateConfig.matrixParameters 371 $size = ($dimensions | Measure-Object -Maximum).Maximum 372 $sparseMatrix.Count | Should -Be $size 373 374 $sparseMatrix[$i].name | Should -Be $name 375 $element = $sparseMatrix[$i].parameters 376 $element.operatingSystem | Should -Be $operatingSystem 377 $element.framework | Should -Be $framework 378 $element.additionalArguments | Should -Be $additionalArguments 379 } 380 381 It "Should generate a sparse matrix from an N-dimensional matrix config" { 382 $sparseMatrix = GenerateMatrix $generateConfig "sparse" 383 $sparseMatrix.Length | Should -Be 4 384 } 385 386 It "Should initialize a full matrix from an N-dimensional matrix config" { 387 $matrix = GenerateMatrix $generateConfig "all" 388 $matrix.Length | Should -Be 13 389 } 390 } 391 392 Describe "Config File Object Conversion" -Tag "convert" { 393 BeforeEach { 394 $config = GetMatrixConfigFromJson $matrixConfig 395 } 396 397 It "Should convert a matrix config" { 398 $config.matrixParameters[0].Name | Should -Be "operatingSystem" 399 $config.matrixParameters[0].Flatten()[0].Value | Should -Be "windows-2019" 400 401 $config.displayNamesLookup | Should -BeOfType [Hashtable] 402 $config.displayNamesLookup["--enableFoo"] | Should -Be "withFoo" 403 404 $config.include.Length | Should -Be 1 405 $config.exclude.Length | Should -Be 3 406 } 407 } 408 409 Describe "Platform Matrix Post Transformation" -Tag "transform" { 410 BeforeEach { 411 $config = GetMatrixConfigFromJson $matrixConfig 412 } 413 414 It "Should match partial matrix elements" -TestCases @( 415 @{ source = [Ordered]@{ a = 1; b = 2; }; target = [Ordered]@{ a = 1 }; expected = $true } 416 @{ source = [Ordered]@{ a = 1; b = 2; }; target = [Ordered]@{ a = 1; b = 2 }; expected = $true } 417 @{ source = [Ordered]@{ a = 1; b = 2; }; target = [Ordered]@{ a = 1; b = 2; c = 3 }; expected = $false } 418 @{ source = [Ordered]@{ a = 1; b = 2; }; target = [Ordered]@{ }; expected = $false } 419 @{ source = [Ordered]@{ }; target = [Ordered]@{ a = 1; b = 2; }; expected = $false } 420 ) { 421 MatrixElementMatch $source $target | Should -Be $expected 422 } 423 424 It "Should remove matrix elements based on exclude filters" { 425 $matrix = GenerateFullMatrix $config.matrixParameters $config.displayNamesLookup 426 $withExclusion = ProcessExcludes $matrix $config.exclude 427 $withExclusion.Length | Should -Be 5 428 429 $matrix = GenerateSparseMatrix $config.matrixParameters $config.displayNamesLookup 430 [array]$withExclusion = ProcessExcludes $matrix $config.exclude 431 $withExclusion.Length | Should -Be 1 432 } 433 434 It "Should add matrix elements based on include elements" { 435 $matrix = GenerateFullMatrix $config.matrixParameters $config.displayNamesLookup 436 $withInclusion = ProcessIncludes $config $matrix "all" 437 $withInclusion.Length | Should -Be 15 438 } 439 440 It "Should include and exclude values with a matrix" { 441 [Array]$matrix = GenerateMatrix $config "all" 442 $matrix.Length | Should -Be 8 443 444 $matrix[0].name | Should -Be "windows2019_netcoreapp21" 445 $matrix[0].parameters.operatingSystem | Should -Be "windows-2019" 446 $matrix[0].parameters.framework | Should -Be "netcoreapp2.1" 447 $matrix[0].parameters.additionalArguments | Should -Be "" 448 449 $matrix[1].name | Should -Be "windows2019_netcoreapp21_withfoo" 450 $matrix[1].parameters.operatingSystem | Should -Be "windows-2019" 451 $matrix[1].parameters.framework | Should -Be "netcoreapp2.1" 452 $matrix[1].parameters.additionalArguments | Should -Be "--enableFoo" 453 454 $matrix[2].name | Should -Be "ubuntu1804_net461" 455 $matrix[2].parameters.framework | Should -Be "net461" 456 $matrix[2].parameters.operatingSystem | Should -Be "ubuntu-18.04" 457 $matrix[2].parameters.additionalArguments | Should -Be "" 458 459 $matrix[4].name | Should -Be "macOS1015_net461" 460 $matrix[4].parameters.framework | Should -Be "net461" 461 $matrix[4].parameters.operatingSystem | Should -Be "macOS-10.15" 462 $matrix[4].parameters.additionalArguments | Should -Be "" 463 464 $matrix[7].name | Should -Be "windows2019_net50_enableWindowsFoo" 465 $matrix[7].parameters.framework | Should -Be "net50" 466 $matrix[7].parameters.operatingSystem | Should -Be "windows-2019" 467 $matrix[7].parameters.additionalArguments | Should -Be "--enableWindowsFoo" 468 } 469 } 470 471 Describe "Platform Matrix Generation With Object Fields" -Tag "objectfields" { 472 BeforeEach { 473 $matrixConfigForObject = @" 474 { 475 "matrix": { 476 "testObject": { 477 "testObjectName1": { "testObject1Value1": "1", "testObject1Value2": "2" }, 478 "testObjectName2": { "testObject2Value1": "1", "testObject2Value2": "2" } 479 }, 480 "secondTestObject": { 481 "secondTestObjectName1": { "secondTestObject1Value1": "1", "secondTestObject1Value2": "2" } 482 }, 483 "testField": [ "footest", "bartest" ] 484 }, 485 "include": [ 486 { 487 "testObjectInclude": { 488 "testObjectIncludeName": { "testObjectValue1": "1", "testObjectValue2": "2" } 489 }, 490 "testField": "footest" 491 } 492 ] 493 } 494 "@ 495 $objectFieldConfig = GetMatrixConfigFromJson $matrixConfigForObject 496 } 497 498 It "Should parse dimensions properly" { 499 [Array]$dimensions = GetMatrixDimensions $objectFieldConfig.matrixParameters 500 $dimensions.Length | Should -Be 3 501 $dimensions[0] | Should -Be 2 502 $dimensions[1] | Should -Be 1 503 $dimensions[2] | Should -Be 2 504 } 505 506 It "Should populate a sparse matrix dimensions properly" { 507 [Array]$matrix = GenerateMatrix $objectFieldConfig "sparse" 508 $matrix.Length | Should -Be 3 509 510 $matrix[0].name | Should -Be "testObjectName1_secondTestObjectName1_footest" 511 $matrix[0].parameters.testField | Should -Be "footest" 512 $matrix[0].parameters.testObject1Value1 | Should -Be "1" 513 $matrix[0].parameters.testObject1Value2 | Should -Be "2" 514 $matrix[0].parameters.secondTestObject1Value1 | Should -Be "1" 515 $matrix[0].parameters.Count | Should -Be 5 516 517 $matrix[1].name | Should -Be "testObjectName2_secondTestObjectName1_bartest" 518 $matrix[1].parameters.testField | Should -Be "bartest" 519 $matrix[1].parameters.testObject2Value1 | Should -Be "1" 520 $matrix[1].parameters.testObject2Value2 | Should -Be "2" 521 $matrix[1].parameters.secondTestObject1Value1 | Should -Be "1" 522 $matrix[1].parameters.Count | Should -Be 5 523 524 $matrix[2].name | Should -Be "testObjectIncludeName_footest" 525 $matrix[2].parameters.testField | Should -Be "footest" 526 $matrix[2].parameters.testObjectValue1 | Should -Be "1" 527 $matrix[2].parameters.testObjectValue2 | Should -Be "2" 528 $matrix[2].parameters.Count | Should -Be 3 529 } 530 531 It "Should splat matrix entries that are objects into key/values" { 532 [Array]$matrix = GenerateMatrix $objectFieldConfig "all" 533 $matrix.Length | Should -Be 5 534 535 $matrix[0].name | Should -Be "testObjectName1_secondTestObjectName1_footest" 536 $matrix[0].parameters.testField | Should -Be "footest" 537 $matrix[0].parameters.testObject1Value1 | Should -Be "1" 538 $matrix[0].parameters.testObject1Value2 | Should -Be "2" 539 $matrix[0].parameters.secondTestObject1Value1 | Should -Be "1" 540 $matrix[0].parameters.Count | Should -Be 5 541 542 $matrix[3].name | Should -Be "testObjectName2_secondTestObjectName1_bartest" 543 $matrix[3].parameters.testField | Should -Be "bartest" 544 $matrix[3].parameters.testObject2Value1 | Should -Be "1" 545 $matrix[3].parameters.testObject2Value2 | Should -Be "2" 546 $matrix[3].parameters.secondTestObject1Value1 | Should -Be "1" 547 $matrix[3].parameters.Count | Should -Be 5 548 549 $matrix[4].name | Should -Be "testObjectIncludeName_footest" 550 $matrix[4].parameters.testField | Should -Be "footest" 551 $matrix[4].parameters.testObjectValue1 | Should -Be "1" 552 $matrix[4].parameters.testObjectValue2 | Should -Be "2" 553 $matrix[4].parameters.Count | Should -Be 3 554 } 555 } 556