Share via

Mocking objects of the library Microsoft.SqlServer.TransactSql.ScriptDom

Ameen Ahmed 0 Reputation points
2024-06-03T09:38:17.7333333+00:00

I am currently writing the unit tests for a class using the Microsoft.SqlServer.TransactSql.ScriptDom library. I am unable write unit tests for my class as I am unable to set the properties of mocked objects as there is no setter for that property. For example, I cannot set the 'Identifiers' property of the class SchemaObjectName as it does not have a setter.

Developer technologies | Visual Studio | Testing
Developer technologies | Visual Studio | Other
Developer technologies | Visual Studio | Other
A family of Microsoft suites of integrated development tools for building applications for Windows, the web, mobile devices and many other platforms. Miscellaneous topics that do not fit into specific categories.
Developer technologies | C#
Developer technologies | C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 83,421 Reputation points Volunteer Moderator
    2024-06-03T16:09:57.6266667+00:00

    you would add an api to mocked object to set the value to return.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.