Ian_7 0 Newbie Poster

Writing a PSUnit test case where I need to get a specific value from a single row in the data table that was generated from my separate powershell function. To do this I figured I could use a foreach loop, but I am not sure how to write the inner code to grab the row value from the second column in the data table. I gave it a try but my $actual variable is coming back with a null value ..

And lastly, I have an assert statment where I am comparing $actual -> $expected

$dt = Get-TableRowCOunts -ServerName $serverName -databaseName $databaseName -filter $filter -Verbose

$expected = "BedTotals"
foreach ($row in $dt) {
   $actual = $row.Table.Name
}

assert-that -ActualValue $actual -constraint {$actual -like "*BedTotals*"}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.