Skip to content

Instantly share code, notes, and snippets.

@DavidArno
Created July 7, 2011 16:27
Show Gist options
  • Save DavidArno/1069907 to your computer and use it in GitHub Desktop.
Save DavidArno/1069907 to your computer and use it in GitHub Desktop.
Comparison of multiple assert per test versus single assert per test
[Test]
public function initialiseSetsUpModelStateAndMap():void
{
var model:Model = new Model();
var state:State = new State();
var map:Dictionary = new Dictionary();
initialise(model, state, map);
assertThat(_model, strictlyEqualTo(model));
assertThat(_state, strictlyEqualTo(state));
assertThat(_pageMap, strictlyEqualTo(map));
}
private var model:Model;
private var state:State;
private var map:Dictionary;
private function helper():void
{
var model:Model = new Model();
var state:State = new State();
var map:Dictionary = new Dictionary();
initialise(model, state, map);
}
public function initialiseSetsUpModel():void
{
helper();
assertThat(_model, strictlyEqualTo(model));
}
public function initialiseSetsUpState():void
{
helper();
assertThat(_state, strictlyEqualTo(state));
}
public function initialiseSetsUpMap():void
{
helper();
assertThat(_pageMap, strictlyEqualTo(map));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment