我正在尝试做一些 Tsqlt 测试,我想将我的数据与测试分开。
所以我有一个带有数据的程序:
alter PROCEDURE [Test_Calss].[test Data_Test]
AS
BEGIN
EXEC tSQLt.FakeTable 'Sales.Customers';
INSERT INTO Sales.Customers(custid, companyname, contactname, contacttitle, address, city, region, postalcode, country, phone, fax)
VALUES(1, N'Customer NRZBB', N'Allen, Michael', N'Sales Representative', N'teste Str. 0123', test', NULL, N'122', test', N'01-342789', N'030-033456');
我还有另一个程序,我想在其中使用假表:
ALTER PROCEDURE [Test_Calss].[test Count_Customer]
AS
BEGIN
EXEC tSQLt.FakeTable 'Sales.Customers';
DECLARE @testres INT; SET @testres = 91;
DECLARE @counter INT;
SELECT @counter = COUNT(*) FROM [Test_Calss].[test Data_Test];
EXEC tSQLt.AssertEquals @testres,@counter;
END;
我需要第一个过程 [Test_Calss].[test Data_Test] 中的假表在第二个过程中被调用和测试。我尝试使用 EXEC,但它没有用。
任何想法如何调用表格及其内容?