FakeTable with tSQLt remove triggers
- by user1454695
I have jsut started to use tSQLt and is about to test a trigger. I call the FakeTable procedure and do my test but the trigger is not executed. If don't use FakeTable the trigger is executed. That seems to be really bad and I canät find any info that there is any method to readded them.
Then I thought the triggers are removed by FakeTable but I can recreate them after the call and did the following code in my test:
DECLARE @createTrigger NVARCHAR(MAX);
SELECT @createTrigger = OBJECT_DEFINITION(OBJECT_ID('MoveDataFromAToB'))
EXEC tSQLt.FakeTable 'dbo.A';
EXEC(@createTrigger);
I got the following error: "There is already an object named 'MoveDataFromAToB' in the database.{MoveDataFromAToB,14} (There was also a ROLLBACK ERROR -- The current transaction cannot be committed and cannot be rolled back to a savepoint. Roll back the entire transaction.{Private_RunTest,60})"
Anyone that have any experience with tSQLt and know anyworkaround for this problem?