| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Disclaimer: Novice in c# and really don't know the impact of the change, the code change was by referring similar usage in the same file. |
Sorry, something went wrong.
|
CI failure seems to be something different. |
Sorry, something went wrong.
|
PRASOON KARUNAN V (@kvprasoon) you might need to look at how the test is constructed. If the test is expecting the object to be disposed, it might explain why the tests are erroring out. |
Sorry, something went wrong.
|
PRASOON KARUNAN V (@kvprasoon) Of the three errors, I think the last failure may be expected based on how your test is written. When you create a new service with a $null display name, the display name gets assigned the value in the name field. If you look at the error output, it indicates you're checking if the display name is $null and that fails because the actual value of the display name is the service name value. You'll have to update your Pester test for display name to ensure that it checks against the value of the name property if the display name is $null. For the first two errors, they indicate that the display name is null when it is not. I wonder if there is a timing issue (i.e. I wonder if the service display name property value does not show up immediately after creating the service). You should try creating some services outside of Pester, show their properties when the new service objects come back, then invoke Get-Service to get the services, and see if the properties are set the way you expect as well. Plus, experiment with timing of those a bit. |
Sorry, something went wrong.
|
Kirk Munro (@KirkMunro) Rain Sallow (/u/ta11ow) (@vexx32) , My earlier comment was for the previous commit, for latest one (not current), the output doesn't contain description and the StartupType in output is StartType, corrected it. |
Sorry, something went wrong.
|
|
||
| if ($displayname) { | ||
| $service.displayname | Should -Be $displayname | ||
| } |
There was a problem hiding this comment.
Rather than make this check conditional such that it only runs some of the time, how about just making it check for the appropriate value and having it run all the time?
$service.displayname | Should -Be $(if ($displayname) {$displayname} else {$name})
Sorry, something went wrong.
There was a problem hiding this comment.
Like the idea, but not really a fan of that particular syntax.
Maybe:
$testvalue = if ($DisplayName) { $displayname } else { $name }
$service.Displayname | should -BeExactly $testvalue
Sorry, something went wrong.
There was a problem hiding this comment.
There is absolutely nothing wrong with using a subexpression here.
Sorry, something went wrong.
There was a problem hiding this comment.
Didn't say it was wrong, just overly long and complicated for a single line. 🙂
Sorry, something went wrong.
There was a problem hiding this comment.
I couldn't disagree more, and the suggestion that the proposed line was "overly long and complicated" is misinformation.
With a condition as simple as this one, it is far better to keep the code focused on the tests being executed by having the condition inline than have more code to look over and more variables to think about.
As an added bonus, once we get a null-coalescing operator, inline code such as what was proposed becomes much, much simpler.
Sorry, something went wrong.
There was a problem hiding this comment.
Rather than make this check conditional such that it only runs some of the time, how about just making it check for the appropriate value and having it run all the time?
$service.displayname | Should -Be $(if ($displayname) {$displayname} else {$name})
This will implicitly add the check, if DisplayName is null, then ServiceName becomes DisplayName
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM
Sorry, something went wrong.
|
🎉v7.0.0-preview.4 has been released which incorporates this pull request.:tada: Handy links: |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
New-Service cmdlet's output doesn't have all properties when assigned to a variable or using -OutVariable.
PR Checklist