Created
September 20, 2011 06:03
-
-
Save drewbourne/1228473 to your computer and use it in GitHub Desktop.
Context Examples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package example { | |
public class ContextExampleTest { | |
private var calculator:Calculator; | |
private var multiplier:uint; | |
private function withCalculator():void { | |
calculator = new Calculator(); | |
} | |
private function withMultiplier():void { | |
multiplier = 2; | |
} | |
[Test] | |
public function a_calculator_should_add_two_numbers_for_the_sum():void { | |
withCalculator(); | |
assertThat(calculator.sum(2, 2), equalTo(4)); | |
} | |
[Test] | |
public function a_calculator_computing_product_should_multiple_two_numbers_for_the_product():void { | |
withCalculator(); | |
withMultiplier(); | |
assertThat(calcular.product(multiplier, 5), equalTo(10)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment