how to mole mulitple interfaces RRS feed

  • Question

  • Hi,

    Just wondering if there is anyway to mole multiple interfaces using moles power tool?

    for instance: I have two classes

    Class A:  IInterface1, IInterface2




    Class B


      void method1(object a)


          IInterface1 interface1 = (IInterface1)a;

          interface1 .DoWork1();

         IInterface2 interface2 = (IInterface2)a;

          interface2 .DoWork2();



    when doing unit test for class B::Method1, how do I create a mole(stub) object that allows me to have stub implementation of both IInterface1 and IInterface2?


    Thanks a lot!




    Monday, March 7, 2011 10:53 PM

All replies

  • Currently this is not a scenario that is supported by Moles. You will need to define a 3rd interface that implements both interface in order to make that work.

    Jonathan "Peli" de Halleux - Try Pex online at www.pexforfun.com!
    Tuesday, March 15, 2011 5:47 AM