I am writing unit test cases for a game I am working on. When the game starts, the player is positioned randomly, and I have two problems with that:
Make the source of randomness an input to the test, and configure it to be the same each time.
Almost all random number generators take a 'seed' value. By providing the same seed value each time, you can know that you will get the same sequence of random numbers and hence the output of your application should be exactly the same.
I have to test all situations in one test case.
Why? You can have multiple test cases. You can pick any number of different and arbitrary random number seeds to create the conditions you want to test. Or simply replace the random positioning with a specific positioning for the purposes of the test.