是否可以重新使用并手动调用其中一项测试?
在下面的示例中,sp_foo_tests.[Test WITHOUT TRIGGER]
和sp_foo_tests.[Test WITHOUT TRIGGER]
应当执行相同的操作,只是其中之一应激活触发器。
代码:
EXEC tSQLt.NewTestClass 'sp_foo_tests';
GO
CREATE PROCEDURE [sp_foo_tests].[SetUp]
AS
BEGIN
EXEC tSQLt.FakeTable 'dbo.foo_table';
INSERT INTO dbo.foo_table (value) VALUES ('some value');
END
GO
CREATE PROCEDURE sp_foo_tests.[Test WITHOUT TRIGGER]
AS
BEGIN
EXEC tSQLt.AssertEquals 1, -1
END
GO
CREATE PROCEDURE sp_foo_tests.[Test WITH TRIGGER]
AS
BEGIN
EXEC tSQLt.ApplyTrigger 'dbo.foo_table', 'trigger_bar'
EXEC sp_foo_tests.[Test WITHOUT TRIGGER]
END
GO