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.
4,818 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.
10,565 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.
336 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 60,206 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