{"action":"created","issue":{"url":"https://api.github.com/repos/Ticketmaster/poshspec/issues/22","repository_url":"https://api.github.com/repos/Ticketmaster/poshspec","labels_url":"https://api.github.com/repos/Ticketmaster/poshspec/issues/22/labels{/name}","comments_url":"https://api.github.com/repos/Ticketmaster/poshspec/issues/22/comments","events_url":"https://api.github.com/repos/Ticketmaster/poshspec/issues/22/events","html_url":"https://github.com/Ticketmaster/poshspec/issues/22","id":168527615,"number":22,"title":"[Bug] Package function returns more than one package causing test to fail","user":{"login":"megamorf","id":1732128,"avatar_url":"https://avatars.githubusercontent.com/u/1732128?v=3","gravatar_id":"","url":"https://api.github.com/users/megamorf","html_url":"https://github.com/megamorf","followers_url":"https://api.github.com/users/megamorf/followers","following_url":"https://api.github.com/users/megamorf/following{/other_user}","gists_url":"https://api.github.com/users/megamorf/gists{/gist_id}","starred_url":"https://api.github.com/users/megamorf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/megamorf/subscriptions","organizations_url":"https://api.github.com/users/megamorf/orgs","repos_url":"https://api.github.com/users/megamorf/repos","events_url":"https://api.github.com/users/megamorf/events{/privacy}","received_events_url":"https://api.github.com/users/megamorf/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Ticketmaster/poshspec/labels/bug","name":"bug","color":"ee0701"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-07-31T17:08:10Z","updated_at":"2016-09-28T20:58:40Z","closed_at":null,"body":"Hey guys,\r\n\r\nI'd like to report an issue I ran into when using the package function. Here's my test:\r\n\r\n```powershell\r\nDescribe 'Common packages & frameworks' {\r\n    Context 'Visual C++ Runtimes' {\r\n        Package 'Microsoft Visual C++ 2005 Redistributable' Version { Should Be '8.0.61001' }\r\n        Package 'Microsoft Visual C++ 2005 Redistributable (x64)' Version { Should Be '8.0.61000' }\r\n    }\r\n}\r\n```\r\nWhen we look at the packages it should be fine:\r\n\r\n    PS C:\\> Get-Package | where name -like \"*C++ 2005*\" | select name, version\r\n    \r\n    Name                                            Version  \r\n    ----                                            -------  \r\n    Microsoft Visual C++ 2005 Redistributable (x64) 8.0.61000\r\n    Microsoft Visual C++ 2005 Redistributable       8.0.61001\r\n\r\nBut here's the thing - it fails with the following error:\r\n\r\n    Describing Common packages & frameworks\r\n       Context Visual C++ Runtimes\r\n        [-] Package property 'Version' for 'Microsoft Visual C++ 2005 Redistributable' Should Be '8.0.61001' 361ms\r\n          String lengths are both 9. Strings differ at index 8.\r\n          Expected: {8.0.61001}\r\n          But was:  {8.0.61000}\r\n          -------------------^\r\n          1: Get-Package -Name 'Microsoft Visual C++ 2005 Redistributable' -ErrorAction SilentlyContinue | Select-Object -ExpandProperty 'Version' | Should Be '8.0.61001'\r\n          at Should<End>, C:\\Program Files\\WindowsPowerShell\\Modules\\pester\\3.4.1\\Functions\\Assertions\\Should.ps1: Zeile 92\r\n          at <ScriptBlock>, <no file>: Zeile 1\r\n          at <ScriptBlock>, C:\\Program Files\\WindowsPowerShell\\Modules\\poshspec\\2.1.12\\Private\\Invoke-PoshspecExpression.ps1: Zeile 12\r\n          at Invoke-Test, C:\\Program Files\\WindowsPowerShell\\Modules\\pester\\3.4.1\\Functions\\It.ps1: Zeile 253\r\n          at ItImpl, C:\\Program Files\\WindowsPowerShell\\Modules\\pester\\3.4.1\\Functions\\It.ps1: Zeile 203\r\n          at It, C:\\Program Files\\WindowsPowerShell\\Modules\\pester\\3.4.1\\Functions\\It.ps1: Zeile 117\r\n          at Invoke-PoshspecExpression, C:\\Program Files\\WindowsPowerShell\\Modules\\poshspec\\2.1.12\\Private\\Invoke-PoshspecExpression.ps1: Zeile 11\r\n          at Package, C:\\Program Files\\WindowsPowerShell\\Modules\\poshspec\\2.1.12\\Public\\Package.ps1: Zeile 42\r\n          at <ScriptBlock>, <no file>: Zeile 3\r\n          at Context, C:\\Program Files\\WindowsPowerShell\\Modules\\pester\\3.4.1\\Functions\\Context.ps1: Zeile 66\r\n          at <ScriptBlock>, <no file>: Zeile 2\r\n          at Describe, C:\\Program Files\\WindowsPowerShell\\Modules\\pester\\3.4.1\\Functions\\Describe.ps1: Zeile 103\r\n          at <ScriptBlock>, <no file>: Zeile 1\r\n        [+] Package property 'Version' for 'Microsoft Visual C++ 2005 Redistributable (x64)' Should Be '8.0.61000' 359ms\r\n\r\nThe first package test fails because the Get-Package call in the package function actually returns two results and then expands it into an array and compares the first element of the array against the expected value:\r\n\r\n    PS C:\\> Get-Package -Name 'Microsoft Visual C++ 2005 Redistributable' | select name,version\r\n    \r\n    Name                                            Version\r\n    ----                                            -------\r\n    Microsoft Visual C++ 2005 Redistributable (x64) 8.0.61000\r\n    Microsoft Visual C++ 2005 Redistributable       8.0.61001\r\n\r\n    PS C:\\> Get-Package -Name 'Microsoft Visual C++ 2005 Redistributable' -ErrorAction SilentlyContinue | Select-Object -ExpandProperty 'Version'\r\n    8.0.61000\r\n    8.0.61001"},"comment":{"url":"https://api.github.com/repos/Ticketmaster/poshspec/issues/comments/250297682","html_url":"https://github.com/Ticketmaster/poshspec/issues/22#issuecomment-250297682","issue_url":"https://api.github.com/repos/Ticketmaster/poshspec/issues/22","id":250297682,"user":{"login":"michaeltlombardi","id":14190564,"avatar_url":"https://avatars.githubusercontent.com/u/14190564?v=3","gravatar_id":"","url":"https://api.github.com/users/michaeltlombardi","html_url":"https://github.com/michaeltlombardi","followers_url":"https://api.github.com/users/michaeltlombardi/followers","following_url":"https://api.github.com/users/michaeltlombardi/following{/other_user}","gists_url":"https://api.github.com/users/michaeltlombardi/gists{/gist_id}","starred_url":"https://api.github.com/users/michaeltlombardi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaeltlombardi/subscriptions","organizations_url":"https://api.github.com/users/michaeltlombardi/orgs","repos_url":"https://api.github.com/users/michaeltlombardi/repos","events_url":"https://api.github.com/users/michaeltlombardi/events{/privacy}","received_events_url":"https://api.github.com/users/michaeltlombardi/received_events","type":"User","site_admin":false},"created_at":"2016-09-28T20:58:40Z","updated_at":"2016-09-28T20:58:40Z","body":"Should this issue have been closed by #26? It seems so."}}
{"actor":{"display_login":"michaeltlombardi"}}