FakeTable throws an exception on tables with "enforced dependencies"
bclothier opened this issue · 2 comments
I'm trying to set up a test case involving a table that is the lynchpin of the database. However, I get this:
[MyTestClass].[Test_It] failed: (Error) A .NET Framework error occurred during execution of user-defined routine or aggregate "SuppressOutput":
System.Data.SqlClient.SqlException: Object '[dbo].[MyTable]' cannot be renamed because the object participates in enforced dependencies.
Few other tables exhibits this as well. It's not exactly clear what "enforced dependencies" is referring to but from my experiment, it seems to be referring to objects that has a WITH SCHEMABINDING
option and contains the table.
Should it be possible to handle this as part of the call to the FakeTable
? Otherwise, it could get tedious removing and there are also performance ramifications for doing that.
This is on my radar. It is complex to solve for the general problem space. However, you could use tSQLt.RemoveObject
to remove the referencing objects in your specific tests.
If you need additional advice on making this work, please consider the tSQLt google group, the tSQLt channel on the SQL Server Community on Slack, or (most effectively) on Stack Overflow using the #tSQLt tag.
Marking this as an enhancement to prioritize.