unit testing for observer pattern
问题 I am rather new for software testing. I wonder what is the right way to make a unit testing for observer pattern? e.g. if we have the following 4 classes implemented: Subject class(attach/detach/notify), Observer interface class (update virtual method), ConcreteSubject class, and ConcreteObserver (concrete update method). how to write test tracks for each of these classes? Is there any good example to take a reference? Thanks for any inputs. 回答1: For the Subject, you can test: if the observer