Skip to content
Advertisement

tSQLt fails when attempting to FakeTable a synonym table

I am using tSQLt (through Red Gate’s SQL Test version 1.0.0.455). tSQLt is installed on database A. I am trying to do a tSQLt.FakeTable on a table in database B on the same SQL server instance through a synonym on database A.

Code:

ALTER PROCEDURE [ErrorType109NonTankHasSizeOrVolume].[test AliasTest] AS

BEGIN
Exec tSQLt.FakeTable ‘dbo.Bygning’;

Insert Into dbo.Bygning (ObjStatus) Values (1);

EXEC tSQLt.AssertEquals 1, 1
END;

Where dbo.Bygning is a synonym in database A referring to a table in database B and ObjStatus is a column in dbo.Bygning

Error message:

Is there any way to tSQLt.FakeTable synonym tables?

Clarification: The error message comes when running the test.

Advertisement

Answer

tSQLt does not support faking on synonyms at the moment. However, I think it may be easy to add support for this. I quickly prototyped the following fix and hope it may solve your issue. Can you please try it and confirm? If it works out for you, I’ll make sure it gets into the next release.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement