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.

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,249 questions
C#
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.
11,094 questions
Visual Studio Testing
Visual Studio Testing
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Testing: The act or process of applying tests as a means of analysis or diagnosis.
351 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 67,921 Reputation points
    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 Answers by the question author, which helps users to know the answer solved the author's problem.