开发者

Database Unit Test in Visual Studio Compare Vars/Columns?

I have a Visual Studio 2008 GDR Database Unit Test (Data Dude) with some TSQL that calls a sproc. I then have a single select statement that produces a 1-row result set with 2 columns. I want to pass the test if the values are equal and开发者_运维百科 fail if it is not equal. I do not understand how to config/code this, can anyone point me in the right direction?

Thanks.


Perhaps if you select the two columns into variables and compare those, rather than working with the result set directly? That's what we do - something like:

DECLARE @Name AS NVARCHAR (50), @Name2 AS NVARCHAR (50)

EXECUTE [dbo].[SomeStoredProcedure] @Name, @NAME2;

IF (@RC <> 1)
  RAISERROR('Source$Update test failed. @RC returned unexpected value.', 11, 1)

SELECT @Name = [Name],
       @Name2 = [Name2]
FROM [dbo].[Sometable]

IF (@Name <> @Name2)
  RAISERROR('SomeStoredProcedure test failed. @Name returned unexpected value.', 11, 1)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜