-
-
Notifications
You must be signed in to change notification settings - Fork 1
feat(project_item): implement Show-ProjectItem function for enhanced item display #153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
acc3422
5be78bb
35ffbc3
19935cc
138615d
e96cf9d
eccf020
8153126
68dc1fe
6d300e2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| function Test_Write_Sucess { | ||
Check noticeCode scanning / PSScriptAnalyzer The cmdlet 'Test_Write_Sucess' does not have a help comment. Note
The cmdlet 'Test_Write_Sucess' does not have a help comment.
|
||
|
|
||
| Invoke-PrivateContext { | ||
| Start-Transcript -Path test.log | ||
|
|
||
Check noticeCode scanning / PSScriptAnalyzer Line has trailing whitespace Note
Line has trailing whitespace
|
||
| #Factors to test | ||
| $factors = @( | ||
| @{ Text = "Test with no other parameters"; ExpectedText = "Test with no other parameters" } | ||
| @{ Color = "Red"; Text = "Red Text"; BetweenQuotes = $false; PreFix = ""; DefaultValue = "(defaultValue)" ; ExpectedText = "Red Text" } | ||
| @{ Color = "Gray"; Text = "Gray Text"; BetweenQuotes = $false; DefaultValue = "(defaultValue)" ; ExpectedText = "Gray Text" } | ||
| @{ Color = "Green"; Text = "Green Text"; BetweenQuotes = $true; PreFix = "Prefix: "; DefaultValue = "(defaultValue)" ; ExpectedText = 'Prefix: "Green Text"' } | ||
| @{ Color = "Blue"; Text = ""; BetweenQuotes = $false; PreFix = "NoText: "; DefaultValue = "(defaultValue)" ; ExpectedText = "NoText: (defaultValue)" } | ||
| @{ Color = "Yellow"; BetweenQuotes = $true; PreFix = "NullText: "; DefaultValue = "(defaultValue)" ; ExpectedText = 'NullText: "(defaultValue)"' } | ||
| @{ Color = "Cyan"; Text = " "; BetweenQuotes = $false; PreFix = "WhiteSpace: "; ; ExpectedText = "WhiteSpace: (empty)" } | ||
| @{ Color = "Cyan"; Text = " "; BetweenQuotes = $true; PreFix = "WhiteSpace2: "; ; ExpectedText = 'WhiteSpace2: "(empty)"' } | ||
| ) | ||
|
|
||
Check noticeCode scanning / PSScriptAnalyzer Line has trailing whitespace Note
Line has trailing whitespace
|
||
| foreach ($factor in $factors) { | ||
| $color = $factor.Color | ||
| $text = $factor.Text | ||
| $BetweenQuotes = $factor.BetweenQuotes | ||
| $PreFix = $factor.PreFix | ||
| $DefaultValue = $factor.DefaultValue | ||
|
|
||
| # Act | ||
|
|
||
| # Capture the output | ||
| # Call the write function with parameters | ||
| write -color $color -text $text -BetweenQuotes:$BetweenQuotes -PreFix $PreFix -DefaultValue $DefaultValue | ||
|
|
||
| } | ||
|
|
||
Check noticeCode scanning / PSScriptAnalyzer Line has trailing whitespace Note
Line has trailing whitespace
|
||
| # Can not use MyTranscript as we are on a private context that does not hase access to Test private functions | ||
| # Code loggic here to extract from transcript | ||
| Stop-Transcript ; | ||
| $transcriptContent = Get-Content -Path test.log | ||
| $i = 0..($transcriptContent.Count - 1) | Where-Object { $transcriptContent[$_] -eq "**********************" } | ||
| $firstLine = $i[1] + 1 ; $lastLine = $i[2] - 1 | ||
| $result = $transcriptContent[$firstLine..$lastLine] | ||
|
|
||
Check noticeCode scanning / PSScriptAnalyzer Line has trailing whitespace Note
Line has trailing whitespace
|
||
| # Assert. | ||
| $assertLine = 0 | ||
| foreach ($factor in $factors) { | ||
| Assert-AreEqual -Expected $factor.ExpectedText -Presented $result[$assertLine] | ||
Check noticeCode scanning / PSScriptAnalyzer Line has trailing whitespace Note
Line has trailing whitespace
|
||
| $assertLine++ | ||
| } | ||
| } | ||
| } | ||
|
|
||
| function Get-Test_Write_Sucess_Factors { | ||
Check noticeCode scanning / PSScriptAnalyzer The cmdlet 'Get-Test_Write_Sucess_Factors' does not have a help comment. Note
The cmdlet 'Get-Test_Write_Sucess_Factors' does not have a help comment.
Check warningCode scanning / PSScriptAnalyzer The cmdlet 'Get-Test_Write_Sucess_Factors' uses a plural noun. A singular noun should be used instead. Warning
The cmdlet 'Get-Test_Write_Sucess_Factors' uses a plural noun. A singular noun should be used instead.
|
||
|
|
||
| return = @( | ||
| @{ Text = "Test with no other parameters"; ExpectedText = "Test with no other parameters" } | ||
| @{ Color = "Red"; Text = "Red Text"; BetweenQuotes = $false; PreFix = ""; DefaultValue = "(defaultValue)" ; ExpectedText = "Red Text" } | ||
| @{ Color = "Gray"; Text = "Gray Text"; BetweenQuotes = $false; DefaultValue = "(defaultValue)" ; ExpectedText = "Gray Text" } | ||
| @{ Color = "Green"; Text = "Green Text"; BetweenQuotes = $true; PreFix = "Prefix: "; DefaultValue = "(defaultValue)" ; ExpectedText = 'Prefix: "Green Text"' } | ||
| @{ Color = "Blue"; Text = ""; BetweenQuotes = $false; PreFix = "NoText: "; DefaultValue = "(defaultValue)" ; ExpectedText = "NoText: (defaultValue)" } | ||
| @{ Color = "Yellow"; BetweenQuotes = $true; PreFix = "NullText: "; DefaultValue = "(defaultValue)" ; ExpectedText = 'NullText: "(defaultValue)"' } | ||
| @{ Color = "Cyan"; Text = " "; BetweenQuotes = $false; PreFix = "WhiteSpace: "; ; ExpectedText = "WhiteSpace: (empty)" } | ||
| @{ Color = "Cyan"; Text = " "; BetweenQuotes = $true; PreFix = "WhiteSpace2: "; ; ExpectedText = 'WhiteSpace2: "(empty)"' } | ||
| ) | ||
| } Export-ModuleMember -Function Get-Test_Write_Sucess_Factors, Test_Write_Sucess | ||
Check notice
Code scanning / PSScriptAnalyzer
Line has trailing whitespace Note