tSQLt has a command called AssertEqualsTable that tests whether contents of 2 tables match.
I would like to understand how the logic works, does it use the first column as a JOIN between the 2 tables, to then test whether the rest of the columns for that row (join) match?
1条答案
按热度按时间ni65a41a1#
AssertEqualsTable compares the whole row - i.e. all columns. For example if the
expected
table has one row of four columns ('A', 'B', 'C', 'D') andactual
also has one row ('A', 'B', 'C', 'E'), the result returned byAssertEqualsTable
will show two rows - the ABCD row expected not found plus the ABCE row returned but NOT expected.There is is no guarantee that the expected and actual tables in every single test that anyone might want to write would even have a unique key so the comparison has to be based on the whole row.