Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
MariusStorhaug committed Dec 8, 2024
1 parent 506e2de commit f075db0
Showing 1 changed file with 0 additions and 53 deletions.
53 changes: 0 additions & 53 deletions tests/Context.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -141,56 +141,3 @@ Describe 'Functions' {
}
}
}

Describe 'Classes' {
Context 'Context' {
It '[Context]::new() | Should -Throw' {
[Context]::new() | Should -Throw
}
It "[Context]::new('TestID') | Should -Not -Throw" {
[Context]::new('TestID') | Should -Not -Throw
}
It "[Context]::new('TestID') | Should -BeOfType 'Context'" {
[Context]::new('TestID') | Should -BeOfType 'Context'
}
It '[Context] can be extended' {
class ExtendedContext : Context {
[string] $Name
[int] $Age
}

$properties = @{
ID = 'TestID'
Name = 'TestName'
Age = 42
}

$context = [ExtendedContext]$properties
$context | Should -BeOfType 'ExtendedContext'
$context.Name | Should -Be 'TestName'
$context.ID | Should -Not
}
It '[Context] can be extended in a class hierarchy' {
class BaseContext : Context {
[string] $Name
}

class ExtendedContext : BaseContext {
[int] $Age
}

$properties = @{
ID = 'TestID'
Name = 'TestName'
Age = 42
}

$context = [ExtendedContext]$properties
$context | Should -BeOfType 'ExtendedContext'
$context.Name | Should -Be 'TestName'
$context.ID | Should -Be 'TestID'
Set-Context -ID 'TestID' -Context $context
[ExtendedContext](Get-Context -ID 'TestID') | Should -BeOfType 'ExtendedContext'
}
}
}

0 comments on commit f075db0

Please sign in to comment.