Is there a way to calculate elapsed time for test methods ignoring time spent initializing?

后端 未结 4 1761
死守一世寂寞
死守一世寂寞 2021-01-19 15:52

This is the kind of question that treads the gray area between StackOverflow and SuperUser. As I suspect the answer is likely to involve code-related solutions, such as crea

4条回答
  •  情深已故
    2021-01-19 16:25

    The problem you run into is that the unit tests don't allow for changing of the time, or output of data - they just execute and finish.

    One way you can do this is to violate Unit Test standards and use a static reference and static constructor to prepare your backing data - while not technically guaranteed, VS 2013 does execute all Unit Tests in the same AppDomain (though via separate instances of the given TestClass)

提交回复
热议问题