Functions/Output.Tests.ps1
InModuleScope -ModuleName Pester -ScriptBlock { Describe 'Has-Flag' -Fixture { It 'Returns true when setting and value are the same' { $setting = [Pester.OutputTypes]::Passed $value = [Pester.OutputTypes]::Passed $value | Has-Flag $setting | Should Be $true } It 'Returns false when setting and value are the different' { $setting = [Pester.OutputTypes]::Passed $value = [Pester.OutputTypes]::Failed $value | Has-Flag $setting | Should Be $false } It 'Returns true when setting contains value' { $setting = [Pester.OutputTypes]::Passed -bor [Pester.OutputTypes]::Failed $value = [Pester.OutputTypes]::Passed $value | Has-Flag $setting | Should Be $true } It 'Returns false when setting does not contain the value' { $setting = [Pester.OutputTypes]::Passed -bor [Pester.OutputTypes]::Failed $value = [Pester.OutputTypes]::Summary $value | Has-Flag $setting | Should Be $false } It 'Returns true when at least one setting is contained in value' { $setting = [Pester.OutputTypes]::Passed -bor [Pester.OutputTypes]::Failed $value = [Pester.OutputTypes]::Summary -bor [Pester.OutputTypes]::Failed $value | Has-Flag $setting | Should Be $true } It 'Returns false when none of settings is contained in value' { $setting = [Pester.OutputTypes]::Passed -bor [Pester.OutputTypes]::Failed $value = [Pester.OutputTypes]::Summary -bor [Pester.OutputTypes]::Describe $value | Has-Flag $setting | Should Be $false } } Describe 'Default OutputTypes' -Fixture { It 'Fails output type contains all except passed' { $expected = [Pester.OutputTypes]'Default, Failed, Pending, Skipped, Inconclusive, Describe, Context, Summary' [Pester.OutputTypes]::Fails | Should Be $expected } It 'All output type contains all flags' { $expected = [Pester.OutputTypes]'Default, Passed, Failed, Pending, Skipped, Inconclusive, Describe, Context, Summary' [Pester.OutputTypes]::All | Should Be $expected } } } |