<commit_before>﻿Import-Module "$PSScriptRoot\DSCResources\xTimeZone\xTimeZone.psm1" -Prefix 'TimeZone' -Force

Describe 'Get-TargetResource'{
    Mock -ModuleName xTimeZone -CommandName Get-TimeZone -MockWith {
        Write-Output 'Pacific Standard Time'
    }
    
     $TimeZone = Get-TimeZoneTargetResource -TimeZone 'Pacific Standard Time'

    It 'Should return hashtable with Key TimeZone'{
        $TimeZone.ContainsKey('TimeZone') | Should Be $true            
    }
     
    It 'Should return hashtable with Value that matches "Pacific Standard Time"'{
        $TimeZone.TimeZone = 'Pacific Standard Time'    
    }
}

Describe 'Set-TargetResource'{

    Mock -ModuleName xTimeZone -CommandName Set-TimeZone -MockWith {
        Write-Output $true
    }
    
    Mock -ModuleName xTimeZone -CommandName Get-TimeZone -MockWith {
        Write-Output 'Eastern Standard Time'    
    }    

    It 'Call Set-TimeZone' {
        Set-TimeZoneTargetResource -TimeZone 'Pacific Standard Time'
        Assert-MockCalled -ModuleName xTimeZone -CommandName Set-TimeZone -Exactly 1 
    }

    It 'Should not call Set-TimeZone when Current TimeZone already set to desired State'{
        $SystemTimeZone = & tzutil.exe /g
        Set-TimeZoneTargetResource -TimeZone $SystemTimeZone<commit_msg>fixed Set tests<commit_after>﻿Import-Module "$PSScriptRoot\DSCResources\xTimeZone\xTimeZone.psm1" -Prefix 'TimeZone' -Force

Describe 'Get-TargetResource'{
    Mock -ModuleName xTimeZone -CommandName Get-TimeZone -MockWith {
        Write-Output 'Pacific Standard Time'
    }
    
     $TimeZone = Get-TimeZoneTargetResource -TimeZone 'Pacific Standard Time'

    It 'Should return hashtable with Key TimeZone'{
        $TimeZone.ContainsKey('TimeZone') | Should Be $true            
    }
     
    It 'Should return hashtable with Value that matches "Pacific Standard Time"'{
        $TimeZone.TimeZone = 'Pacific Standard Time'    
    }
}

Describe 'Set-TargetResource'{

    Mock -ModuleName xTimeZone -CommandName Set-TimeZone -MockWith {
        Write-Output $true
    }
    
    Mock -ModuleName xTimeZone -CommandName Get-TimeZone -MockWith {
        Write-Output 'Eastern Standard Time'    
    }    

    It 'Call Set-TimeZone' {
        Set-TimeZoneTargetResource -TimeZone 'Pacific Standard Time'
        Assert-MockCalled -ModuleName xTimeZone -CommandName Set-TimeZone -Exactly 1 
    }

    It 'Should not call Set-TimeZone when Current TimeZone already set to desired State'{
        $SystemTimeZone = Get-TimeZoneTargetResource -TimeZone 'Eastern Standard Time'
        Set-TimeZoneTargetResource -TimeZone $SystemTimeZone.TimeZone
{'fraction_non_alphanumeric': 0.080999242997729, 'fraction_numerical': 0.001514004542013626, 'mean_word_length': 2.9097633136094676, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6917971', 'n_tokens_mistral': 782, 'n_tokens_neox': 745, 'n_words': 210}