Tests/Get-DBaseMetadata.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
$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.DBaseNorthWindDbPath )) {
    throw "This script requires the 'Northwind' sample database, which is part of the Visual DBase OLEDB driver installation package."
}
$BecauseWeDoNotHaveGoodDbaseTestFiles = "we do not have good dBase test files"

Describe "Get-DBaseTableMetaData with -Datasource to 'Northwind'"  -Tag 'Get-DBaseTableMetaData', DataSource, OLEDB {
    
    It "should return a result set" {
        Set-ItResult -Skipped -Because $BecauseWeDoNotHaveGoodDbaseTestFiles
        Get-DBaseTableMetaData -Datasource $TestConfiguration.DBaseNorthWindDbPath |
            Should -Not -BeNullOrEmpty
    }
}

Describe "Get-DBaseIndexMetaData with -Connection to '$($cp.DataSource)'" -Tag Get-DBaseIndexMetaData, DataSource, OLEDB {
    $TableName = 'employees'
    
    It "should return a result set for '$TableName'" {
        Set-ItResult -Skipped -Because $BecauseWeDoNotHaveGoodDbaseTestFiles
        Get-DBaseIndexMetaData -Datasource $TestConfiguration.DBaseNorthWindDbPath -TableName $TableName |
            Should -Not -BeNullOrEmpty
    }
}