Thank you @ betacat for reminding me. I"ll delete the previous rough example and give a specific scenario:
suppose I need to test a strategy game. At present, the resources are 15 units, and the resources will not be updated until at least 300 seconds. According to the formula, the resources should be 35 units after 300 seconds.
if the time value of the interface is obtained from the system time, it is difficult for me to forge it directly. So I would like to ask: how can I quickly test .
I don"t know what the bosses have in mind.
< hr >optional crab: more comprehensive test books or medium-and long-length tutorials (unlimited language, confused about "Why to write tests" and "how to design good and comprehensive tests"), please recommend
< hr >@ original sin teacher provides Observer Mode: test code subscribe to event topics, and real executors publish event topics. This coupling is the lowest "answer", although it does not solve my confusion of "how to test quickly", but it is very instructive.
because it is in the comments, it is posted for your reference. Thanks again to the two bosses who answered: d .