I have a stored procedure that I am trying test for the proper generation of an output parameter. I experimented with tsqlt.ExpectException, but that did not work. I instead am trying tsqlt.AssertEqualsTable.
CREATE TABLE #actual (msg NVARCHAR(MAX));
CREATE TABLE #expected (msg NVARCHAR(MAX));
INSERT #expected (msg) VALUES (N'Location w1005 has LPNs that were produced against a different production order than 1')
--EXEC tSQLt.ExpectException @ExpectedMessage = N'Location 1 has LPNs that were produced agains a different production order than orderNumber';
EXEC dbo.wms_whse_check_location
@command = @Command, @operLocationHasOtherLPN=@operLocationHasOtherLPN OUTPUT;
INSERT #actual (msg) VALUES (@operLocationHasOtherLPN)
EXEC tsqlt.AssertEqualsTable @Expected = '#expected', @actual = '#actual'
The test fails, and the output from tsqlt is:
Unexpected/missing resultset rows! |m|msg | +---+--------------------------------------------------------------------------------------+ |< |Location w1005 has LPNs that were produced against a different production order than 1| |> |Location w1005 has LPNs that were produced against a different production order than l|
It may be hard to see in the above snip, but the < (expected) row is identical to the > (actual) row -- tsqlt finds a difference that in fact doesn't exist. I'm not choosing the correct method it seems.
Has anyone written tests to check ouput parameters? What is the appropriate method? Thanks
p.s. Apologies for the messy formatting. I'm not a regular poster.