Skip to content

Commit

Permalink
Fix cut paste goof
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinGrote committed Jun 15, 2023
1 parent caa876c commit d9ab480
Showing 1 changed file with 3 additions and 55 deletions.
58 changes: 3 additions & 55 deletions tests/Lab.3.Bouncer.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Describe 'Lab 3: Bouncer Script' {

Context 'Assert-PEUAge' {
It 'Passes thru the user object if the user is of age' {
$user = [Person]::new(
$user = [PEURandom.Person]::new(
'PSConfEUParticipant',
(Get-Date).AddYears(-25)
)
Expand All @@ -37,7 +37,7 @@ Describe 'Lab 3: Bouncer Script' {
$actual | Should -Be $user
}
It 'Throws InvalidOperationException if the specified user is under -Age' {
$user = [Person]::new(
$user = [PEURandom.Person]::new(
'UnderAgePSConfEUParticipant',
(Get-Date).AddYears(-15)
)
Expand All @@ -46,59 +46,7 @@ Describe 'Lab 3: Bouncer Script' {
$user | Assert-PEUAge -Age 18
}

$testPeuAgeScript | Should -Throw -ExceptionType using namespace PEURandom;
Describe 'Lab 3: Bouncer Script' {
BeforeAll {
. $PSScriptRoot/Shared.ps1
Initialize-TestEnvironment -ProjectName 'Lab.3.Bouncer'
}

Context 'Get-PEUAge' {
It 'Generates a random birthday for the subject' {
$actual = Get-PEUAge -Name 'PSConfEUParticipant'
$actual.Name | Should -Be 'PSConfEUParticipant'
$actual.BirthDate | Should -BeOfType [DateTime]
}
It 'Generates random BirthDate for each name provided via the pipeline' {
$names = 'PSConfEUParticipant', 'PSConfEUParticipant2', 'PSConfEUParticipant3'

$actual = $names | Get-PEUAge
$actual.Count | Should -BeExactly $names.Count
$names | ForEach-Object {
$actual.name | Should -Contain $_
}
$actual.BirthDate.count | Should -BeExactly $names.Count
$actual.BirthDate | ForEach-Object {
$PSItem | Should -BeOfType [DateTime]
}
}
}

Context 'Assert-PEUAge' {
It 'Passes thru the user object if the user is of age' {
$user = [PEURandom.Person]::new(
'PSConfEUParticipant',
(Get-Date).AddYears(-25)
)

$actual = $user | Assert-PEUAge -Age 18

$actual | Should -Be $user
}
It 'Throws InvalidOperationException if the specified user is under -Age' {
$user = [PEURandom.Person]::new(
'UnderAgePSConfEUParticipant',
(Get-Date).AddYears(-15)
)

$testPeuAgeScript = {
$user | Assert-PEUAge -Age 18
}

$testPeuAgeScript | Should -Throw -ExceptionType ([System.IO.InvalidDataException])
}
}
}
$testPeuAgeScript | Should -Throw -ExceptionType ([System.IO.InvalidDataException])
}
}
}

0 comments on commit d9ab480

Please sign in to comment.