I'm using Rhino Mocks to try to verify that when I call a certain method, that the method in turn will properly group items and then call another method.
Something like this:
//Arrange
var bucketsOfFun = new BucketGame();
var balls = new List<IBall>
{
new Ball { Color = Color.Red },
new Ball { Color = Color.Blue },
new Ball { Color = Color.Yellow },
new Ball { Color = Color.Orange },
new Ball { Color = Color.Orange }
};
//Act
bucketsOfFun.HaveFunWithBucketsAndBalls(balls);
//Assert ???
Here is where the trouble begins for me. My method is doing something like this:
public void HaveFunWithBucketsAndBalls(IList<IBall> balls)
{
//group all the balls together according to color
var blueBalls = GetBlueBalls(balls);
var redBalls = GetRedBalls(balls);
// you get the idea
HaveFunWithABucketOfBalls(blueBalls);
HaveFunWithABucketOfBalls(redBalls);
// etc etc with all the different colors
}
public void HaveFunWithABucketOfBalls(IList<IBall> colorSpecificBalls)
{
//doing some stuff here that i don't care about
//for the test i'm writing right now
}
What I want to assert is that each time I call HaveFunWithABucketOfBalls that I'm calling it with a group of 1 red ball, then 1 blue ball, then 1 yellow ball, then 2 orange balls.
If I can assert that behavior then I can verify that the method is doing what I want it to do, which is grouping the balls properly.
Any ideas of what the best testing pattern for this would be?