Pester/New-MicrosoftHealth.tests.ps1

<#
  Pester provides a framework for running Unit Tests to execute and validate PowerShell commands inside of PowerShell.
  More info can be found here:
  https://github.com/pester/Pester

  To test run the following command:
  invoke-pester from ..\Pester\ folder

#>


Remove-Module MicrosoftHealth -Force -ErrorAction SilentlyContinue

$scriptRoot = Split-Path -Path $MyInvocation.MyCommand.Path
cd $scriptRoot
cd ..\
Import-Module .\MicrosoftHealth.psm1 -Force -ErrorAction Stop

Describe 'Test Authentication Settings' {

Context "Test configuration of Authentication.config.xml file" {
        It "Throws an error when there is no Authentication.config.xml file found in MicrosoftHealth Module folder" {
            {Load-AuthenticationSettings} | Should not Throw
        }
    }
}

Describe 'Test MicrosoftHealth Module Functions' {
    It 'outputs Get-MicrosoftHealthDevice' {
                Get-MicrosoftHealthDevice | Should not Be $null
    }

        It 'outputs Get-MicrosoftHealthProfile' {
                (Get-MicrosoftHealthProfile).createdTime | Should Match "^20*" #Checks if the profile created propery start with 20. (for the year)
    }

    It 'outputs Get-MicrosoftHealthSummary period Hourly' {
                Get-MicrosoftHealthSummary -Period Hourly | Should not Be $null
    }

    It 'outputs Get-MicrosoftHealthSummary period Daily' {
                Get-MicrosoftHealthSummary -Period Daily | Should not Be $null
    }
}