locked
Newbie question : how to test Interface in UnitTest?

    Question


  • For example, there is a interface IMyInterface, and three class support this interface :

    class A : IMyInterface
    {
    }

    class B : IMyInterface
    {
    }

    class C : IMyInterface
    {
    }

    In the simplest way, I could write three test class : ATest, BTest, CTest and test them separatedly. However, since they support the same interface, most test code would be the same, it's hard to maintain. How can I use a simple and easy way to test a interface that is supported by different class?

    Thanks!

    Thursday, May 04, 2006 5:11 AM

Answers

  • No, but you could use a csv. See Sean's blog at blogs.msdn.com/slumley for details.

    Ed.

    Wednesday, May 10, 2006 2:05 PM

All replies

  • I read the UnitTest section of MSDN library carefully. It seems I could use "Data-Driven Unit Test" and put the concrete class type names in a MDB table. This make it possible to test every concrete class by only one set of test code.

    This looks strange.

    Besides MDB, could I use a XML file?

     

    Thursday, May 04, 2006 12:21 PM
  • No, but you could use a csv. See Sean's blog at blogs.msdn.com/slumley for details.

    Ed.

    Wednesday, May 10, 2006 2:05 PM