locked
Does mole generation skip abstract properties and methods of an abstract class?

    Question

  • Does mole generation skip abstract properties and methods of an abstract class? How to enable that? I cannot use stubs for this task because i need to change
    sealed methods as well.
    Saturday, November 21, 2009 10:39 PM

Answers

  • You cannot mole abstract methods.
    However, you can mole the overriden methods of any non-abstract subclass.



    Nikolai Tillmann - Tell us how you use Pex
    • Marked as answer by xor88 Monday, November 23, 2009 10:54 PM
    Saturday, November 21, 2009 11:26 PM
    Owner

All replies

  • You cannot mole abstract methods.
    However, you can mole the overriden methods of any non-abstract subclass.



    Nikolai Tillmann - Tell us how you use Pex
    • Marked as answer by xor88 Monday, November 23, 2009 10:54 PM
    Saturday, November 21, 2009 11:26 PM
    Owner
  • Ok. I am curious: Why is that?

    PS: How can i disable notifications if "the thread type" of this forum has been changed or "a post has been proposed as answer"?
    Monday, November 23, 2009 5:23 PM
  • > Ok. I am curious: Why is that?

    The practical explanation is that in our implementation of Moles the actual detouring happens via code injected into the method that is being detoured. (See slide titled "Moles under the hood" in http://research.microsoft.com/en-us/projects/pex/stubsmolespublic.pptx.) Thus, if a method has no body (such as an abstract method), we cannot detour it.


    Nikolai Tillmann - Tell us how you use Pex
    Monday, November 23, 2009 6:40 PM
    Owner