Testing "complex" operations : Risk-like board game deployment
===

I develop a Risk-like game with Ruby on Rails and I have to develop a procedure to dispatch (randomly) territories among characters and to dispatch (randomly) characters' units to their territories.

The game has 42 territories for 5 characters. 3 characters receive 8 territories and 2 characters receive 9 territories. Each character has a pool of 25 units (27 for ones having 9 territories) to dispatch among allocated territories. Each territory must end up with at least 1 unit.

My models are the following. I'm okay to change it if needed.

  - User ;
  - Game ;
  - Area ;
  - Character, binding a user to a game, holding the remaining units to deploy ;
  - Territory, link a character to an area, holding the number of units on that area.


Now here are my thoughts.

  - I should separate the two operations (territories dispatch and units dispatch), even if it less performant ;
  - To test more easily, the output state should be the same with a same input : the random part should come from outside.


What assertions would you write for such a scenario?
I use the default Rails 3 testing stack : Test::Unit and fixtures.


[The code is available on GiitHub][1].


Thanks!


  [1]: https://github.com/Sephi-Chan/conquest-on-rails-reboot