3

I would like to know how to unit test sequences like Observable.Never.

How can I be sure that nothing will be pushed to the sequence?

SuperJMN
  • 13,110
  • 16
  • 86
  • 185

1 Answers1

6

You cannot be sure that nothing is ever pushed to observable, because that is equivalent to solving Halting problem, which is impossible. That is: you want to know if your program will ever terminate (something pushed) or will run forever (nothing ever pushed).

The best you can do is check if nothing is pushed during arbitrary timeout of your choice.

That said - you don't need to test Observable.Never anyway. If you have certain real code with observable that should never push any items - please show that in question.

Evk
  • 98,527
  • 8
  • 141
  • 191