0

I have a dispatch timer in my application.It is called in an event, but here we are not calling it. I need to get that from unit test.

When i went through google, I got as "It's best if you can avoid Dispatcher Timer in your system under test".

Can i get any suggestions!!

instead of using a Dispatcher Timer, it works fine with an ordinary Timer. But Dispatcher Timer never fires.

  • 3
    If you want to have a unit-testable class you should inject **all** dependencies. And `DispatcherTimer` is such a dependency. – Sir Rufo Nov 04 '19 at 09:38
  • 1
    Encapsulate the dispatch timer behind an injectable abstraction that can be replaced when unit testing in isolation. – Nkosi Nov 04 '19 at 10:47

0 Answers0