Skip to content

Commit

Permalink
Fix PS test failure.
Browse files Browse the repository at this point in the history
  • Loading branch information
rnwood committed Dec 28, 2024
1 parent c8fa8e7 commit f010218
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,13 @@ private QueryExpression GetSimpleQuery()
throw new InvalidDataException($"The key '{filterValue.Key}' is invalid. Valid formats are 'fieldname' or 'fieldname:operator'");
}

includeFilterExpression.AddCondition(fieldName, op,
filterValue.Value);
if (filterValue.Value is Array array)
{
includeFilterExpression.AddCondition(fieldName, op, (object[])array);
} else
{
includeFilterExpression.AddCondition(fieldName, op, filterValue.Value);
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Get-DataverseRecord.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Describe 'Get-DataverseRecord' {

$connection = getMockConnection
1..10 | ForEach-Object { @{"firstname" = "$_" } } | Set-DataverseRecord -Connection $connection -TableName contact
$result = Get-DataverseRecord -Connection $connection -TableName contact -filter @{"firstname:In"=@("1", "2")}
$result = Get-DataverseRecord -Connection $connection -TableName contact -filter @{"firstname:In"=("1", "2")}
$result | Should -HaveCount 2
}

Expand Down

0 comments on commit f010218

Please sign in to comment.