Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SqlAudit: Fix unit tests #2038

Merged
merged 2 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `Connect-SqlDscDatabaseEngine`
- Comment-based help for parameter `LoginType` was corrected.
- An integration test now runs to test the command.
- SqlAudit
- Fixed unit tests.

## [16.6.0] - 2024-05-17

Expand Down
18 changes: 12 additions & 6 deletions tests/Unit/Classes/SqlAudit.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ Describe 'SqlAudit\Set()' -Tag 'Set' {
}
}

It 'Should not call method Modify()' {
It 'Should call method Modify()' {
InModuleScope -ScriptBlock {
$script:mockSqlAuditInstance.Set()

Expand Down Expand Up @@ -346,11 +346,17 @@ Describe 'SqlAudit\Test()' -Tag 'Test' {
$script:mockSqlAuditInstance |
# Mock method Compare() which is called by the base method Set()
Add-Member -Force -MemberType 'ScriptMethod' -Name 'Compare' -Value {
return @{
Name = 'MockAuditName'
InstanceName = 'NamedInstance'
Path = 'C:\WrongFolder'
}
<#
Compare() method shall only return the properties NOT in
desired state, in the format of the command Compare-DscParameterState.
#>
return @(
@{
Property = 'Path'
ExpectedValue = 'C:\Temp'
ActualValue = 'C:\WrongFolder'
}
)
} -PassThru |
Add-Member -Force -MemberType 'ScriptMethod' -Name 'AssertProperties' -Value {
return
Expand Down
Loading