main
1using developwithpassion.bdd.contexts;
2using developwithpassion.bdd.mbunit;
3using developwithpassion.bdd.mbunit.standard.observations;
4using mars.rover.domain;
5
6namespace specifications.domain
7{
8 public class CoordinateSpecs
9 {
10 }
11
12 public class when_a_coordinate_is_compared_to_another_coordinate : observations_for_a_static_sut
13 {
14 it should_tell_which_is_greater = () => new Coordinate(2).CompareTo(1).should_be_greater_than(0);
15 it should_tell_which_is_lower = () => new Coordinate(1).CompareTo(2).should_be_less_than(0);
16 it should_tell_when_they_are_equal = () => new Coordinate(1).CompareTo(1).should_be_equal_to(0);
17 }
18
19 public class when_one_coordinate_is_added_to_another_coordinate :
20 observations_for_a_sut_without_a_contract<Coordinate>
21 {
22 it should_return_a_new_coordinate_with_the_proper_grid_point = () => result.should_be_equal_to<Coordinate>(2);
23
24 context c = () =>
25 {
26 uint initial = 1;
27 provide_a_basic_sut_constructor_argument(initial);
28 };
29
30 because b = () => { result = sut.plus(1); };
31
32 static Coordinate result;
33 }
34
35 public class when_one_coordinate_is_subtracted_from_another_coordinate :
36 observations_for_a_sut_without_a_contract<Coordinate>
37 {
38 it should_return_a_new_coordinate_with_the_proper_grid_point = () => result.should_be_equal_to<Coordinate>(0);
39
40 context c = () =>
41 {
42 uint initial = 1;
43 provide_a_basic_sut_constructor_argument(initial);
44 };
45
46 because b = () => { result = sut.minus(1); };
47
48 static Coordinate result;
49 }
50}