File tree Expand file tree Collapse file tree
PSFramework/tests/functions/utility Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- Describe " Select-PSFObject Unit Tests" - Tag " UnitTests" {
1+ Describe " Select-PSFObject Unit Tests" - Tag " UnitTests" {
22 BeforeAll {
33 $object = [PSCustomObject ]@ {
44 Foo = 42
1818 Bar = 88
1919 Tara = 28
2020 }
21+
22+ $variable = 42
2123 }
2224
2325 Describe " Basic DSL functionalities" {
3436 ($object2 | Select-PSFObject - Property ' Foo size KB:1:1' ).Foo | Should - Be " 41 KB"
3537 }
3638 }
37-
38- Describe " Selects from other variables" {
39- It " picks values from other variables" {
39+
40+ Describe " Selects from other object variables" {
41+ It " picks values from other object variables" {
4042 ($object2 | Select-PSFObject - Property ' Tara from object' ).Tara | Should - Be 21
4143 }
4244
4345 It " picks values from the properties of the right object in a list" {
4446 ($object2 | Select-PSFObject - Property ' Tara from List where Foo = Bar' ).Tara | Should - Be 28
4547 }
4648 }
47-
49+
50+ Describe " Selects from other non-object variables" {
51+ It " picks values from other non-object variables" {
52+ ($object2 | Select-PSFObject - Property ' $variable as Tara' ).Tara | Should - Be 42
53+ }
54+ It " uses the variable name as property name" {
55+ ($object2 | Select-PSFObject - Property ' $variable' ).variable | Should - Be 42
56+ }
57+ }
58+
4859 Describe " Display Settings are applied" {
4960 It " sets the correct properties to show in whitelist mode" {
5061 $obj = [PSCustomObject ]@ { Foo = " Bar" ; Bar = 42 ; Right = " Left" }
You can’t perform that action at this time.
0 commit comments