From d9ab480d47c60f2cabccca32d01fd42fc5606925 Mon Sep 17 00:00:00 2001 From: Justin Grote Date: Thu, 15 Jun 2023 10:04:43 +0200 Subject: [PATCH] Fix cut paste goof --- tests/Lab.3.Bouncer.Tests.ps1 | 58 ++--------------------------------- 1 file changed, 3 insertions(+), 55 deletions(-) diff --git a/tests/Lab.3.Bouncer.Tests.ps1 b/tests/Lab.3.Bouncer.Tests.ps1 index d3eca7f..440c298 100644 --- a/tests/Lab.3.Bouncer.Tests.ps1 +++ b/tests/Lab.3.Bouncer.Tests.ps1 @@ -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) ) @@ -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) ) @@ -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]) } } } \ No newline at end of file