How to Mock the Internal Method of a class?

后端 未结 6 2065
别跟我提以往
别跟我提以往 2020-12-05 18:07

I have a class which has a internal method and i want to mock the internal method . But i am unable to mock it i.e. it is not calling the mocked function but calling the ori

6条回答
  •  青春惊慌失措
    2020-12-05 18:39

    Not with Moq.

    But you can use the free Moles framework from MS to do such things. I wrote about it here: Mocking the Unmockable: Using Microsoft Moles with Gallio. (it applies not only to Gallio, but it gives a good overall impression of what you can do with Moles...). The other alternative would be Typemock...

    HTH. Thomas

提交回复
热议问题