Skip to content
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

Three Issues with "AboutSelectObject.Koans.ps1" #339

Closed
ghost opened this issue Jan 3, 2020 · 1 comment · Fixed by #347
Closed

Three Issues with "AboutSelectObject.Koans.ps1" #339

ghost opened this issue Jan 3, 2020 · 1 comment · Fixed by #347
Assignees
Labels
Category-Koans Invoking the Great Doubt Issue-Bug 🐛 Something's wrong! Issue-Enhancement 🎉 Make it better!

Comments

@ghost
Copy link

ghost commented Jan 3, 2020

Describe "Koan Bug, Issue, or Help Request"

ISSUE 1: Value to be evaluated in the Pester test was null, and type for Pester test is incorrect.

Original Line 53:

$Selected.GetType().FullName | Should -BeOfType [System.IO.Directoryinfo]

Modified Line 53:

$Folder.GetType().FullName | Should -BeOfType [System.String]

ISSUE 2: Code presented did not contain a property that would satisfy the associated Pester test.
Previous examples of $Selected contain references to a property that would satisfy the Pester test, so adding the appropriate code and using the abbreviations for Name and Element to get the code to fit with the current example is needed.

Original at line 244:

    $Selected = Get-Process -Id $PID | Select-Object @(
        'Name'
        'Id'
        @{ n = 'Size'; e = { (Get-Item $_.Path).Length } }
    )

Modified at Line 244

    $Selected = Get-Process -Id $PID | Select-Object @(
        'Name'
        'Id'
        @{ n = 'RunningTime'; e = { (Get-Date) - $_.StartTime } }
        @{ n = 'Size'; e = { (Get-Item $_.Path).Length } }
    )

So that the line at what is now 251 makes sense

$Selected.____ | Should -BeOfType [TimeSpan]

**ISSUE 3: ** Depending on the intent of the developer.
Given what I understand to be the intent, you may have wanted the student to explore PSCustomObject to discover how it is a System.Management.Automation.PSObject, however things were a bit ambiguous as to exactly how you wanted to have the student demonstrate that they had done the exploration. I have provide a tweak/suggestion that may prevent others from posting an issue with the code.

Original at line 297 or 298 if previous changes have been made:

[PSCustomObject] | Should -Be [System.Management.Automation.PSObject]

Modified at line 297 0r 298

Could be
[PSCustomObject].____ | Should -Be System.Management.Automation.PSObject

With the solution being
[PSCustomObject].FullName | Should -Be System.Management.Automation.PSObject

@ghost ghost added Category-Koans Invoking the Great Doubt Issue-Discussion Let's talk about it! labels Jan 3, 2020
@vexx32
Copy link
Owner

vexx32 commented Jan 3, 2020

Good catch on these!

Let's see...

Issue 1

The suggested change would somewhat water down the concept being shown there, but it does need to be corrected. I'd suggest something more like this:

$Folder | Should -BeOfType [__]

(With the solution to the blank being [System.IO.DirectoryInfo])

Alternately, we could have $Folder.GetType().Fullname | Should -BeExactly ____ where the solution would be similar: System.IO.DirectoryInfo

Issue 2

Agreed, that one got lost somewhere in a rewrite I'd guess. Probably just replace the Size calculated property with the RunningTime calculated property there, it doesn't seem like the Size one gets used at all?

Issue 3

Agreed on that one too, that makes a lot more sense; thanks! 😊

@vexx32 vexx32 added Good First Issue ❇️ Should be quick and easy! Hacktoberfest 💻 Issue-Bug 🐛 Something's wrong! Issue-Enhancement 🎉 Make it better! Up For Grabs / Hacktoberfest 💻 If it's Up For Grabs, take it and run with it! If not, ask if it's in progress / you can take it. and removed Issue-Discussion Let's talk about it! labels Jan 3, 2020
@vexx32 vexx32 removed Hacktoberfest 💻 Good First Issue ❇️ Should be quick and easy! Up For Grabs / Hacktoberfest 💻 If it's Up For Grabs, take it and run with it! If not, ask if it's in progress / you can take it. labels Jan 15, 2020
@vexx32 vexx32 self-assigned this Jan 18, 2020
vexx32 added a commit that referenced this issue Jan 18, 2020
vexx32 added a commit that referenced this issue Jan 19, 2020
* 🔧 Resolve issues in AboutModules

Fixes #342

* 🔧 Fix issues in AboutTeeObject

Fixes #341

Also added a new koan to show when the variable is created

* 🔧 Fix issues in AboutMeasureObject

Fixes #340

* 🔧 Fix issues in AboutSelectObject

Fixes #339

Fixes #337

* 🔧 Fix issue in AboutAssignmentAndArithmetic

Fixes #334

* 🔧 Fix issues in AboutDiscovery

Fixes #335

Fixes #332

* 🔧 ♻️ Fix up AboutArrays

Fixes #330

* 🔧 Fix missing variable reference

* 🎨 Update format of array declaration
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category-Koans Invoking the Great Doubt Issue-Bug 🐛 Something's wrong! Issue-Enhancement 🎉 Make it better!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant