What is the Shadowing attribute that the VS uses when it generates unit tests?

后端 未结 1 907
予麋鹿
予麋鹿 2021-01-18 07:36

When i generated unit tests the Visual studio added some fictive class that mocks my class and added the \"Shadowing\" attribute. What does it do?

1条回答
  •  醉话见心
    2021-01-18 07:55

    Did some research and found this. Apparantly, the [Shadowing] attribute is used by MSTest when it creates an accessor class that allows you to call a private method on a class as if it were public.

    So when you're unit testing a private method of a target class, that private method will be available to you via the accessor wrapper class for the target class.

    0 讨论(0)
提交回复
热议问题