Unit testing factory methods which have a concrete class as a return type

前端 未结 5 447
醉梦人生
醉梦人生 2020-12-15 03:35

So I have a factory class and I\'m trying to work out what the unit tests should do. From this question I could verify that the interface returned is of a particular concret

5条回答
  •  误落风尘
    2020-12-15 03:52

    What we do is create the dependancies with factories, and we use a dependancy injection framework to substitute mock factories for the real ones when the test is run. Then we set up the appropriate expectations on those mock factories.

提交回复
热议问题