Tests/Get-FoxProMetadata.Tests.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
$CommandName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "")

# go "one up" from the Tests folder
$Path = Split-Path -Parent -Path $PSScriptRoot

$ManifestFile = (Get-ChildItem  -Path $Path -Filter "*.psd1").FullName
Import-Module $ManifestFile -DisableNameChecking -Force


$TestConfiguration = Invoke-Expression -Command (Join-Path -Path $PSScriptRoot -ChildPath 'Get-LegacyDataTestValue.ps1')

if (-not (Test-Path $TestConfiguration.FoxProNorthWindDbPath )) {
    throw "This script requires the 'Northwind' sample database, which is part of the Visual FoxPro OLEDB driver installation package."
}

$BecauseFPOleDbHasNo64BitDriver = "FPOleDb driver has no 64-bit version, only a 32-bit version"
Describe "Get-FoxProTableMetaData with -Datasource to 'Northwind'" -Tag 'Get-FoxProTableMetaData', DataSource, OLEDB {
    
    It "should return a result set" {
        if ([Environment]::Is64BitProcess) { Set-ItResult -Skipped -Because $BecauseFPOleDbHasNo64BitDriver }

        Get-FoxProTableMetaData -Datasource ($TestConfiguration.FoxProNorthWindDbPath) |
            Should -Not -BeNullOrEmpty
    }
}

Describe "Get-FoxProIndexMetaData with -Connection to '$($cp.DataSource)'" -Tag Get-FoxProIndexMetaData, DataSource, OLEDB {
    $TableName = 'employees' 
    
    It "should return a result set for '$TableName'" {
        if ([Environment]::Is64BitProcess) { Set-ItResult -Skipped -Because $BecauseFPOleDbHasNo64BitDriver }
        Get-FoxProIndexMetaData -Datasource $TestConfiguration.FoxProNorthWindDbPath -TableName $TableName |
            Should -Not -BeNullOrEmpty
    }
}