main
 1using System;
 2using developwithpassion.bdd;
 3using developwithpassion.bdd.contexts;
 4using developwithpassion.bdd.mbunit;
 5using developwithpassion.bdd.mbunit.standard.observations;
 6using mars.rover.domain;
 7using mars.rover.presentation.model;
 8using Rhino.Mocks;
 9
10namespace specifications.presentation.model
11{
12    public class NavigationSpecs
13    {
14    }
15
16    public class when_applying_a_navigation_against_a_rover : observations_for_a_sut_without_a_contract<Navigation>
17    {
18        it should_direct_the_rover_correctly = () => rover.received(x => x.turn_left());
19
20        context c = () =>
21                        {
22                            rover = MockRepository.GenerateStub<Rover>(new Coordinate(0), new Coordinate(0), an<Heading>());
23                            provide_a_basic_sut_constructor_argument('l');
24                            provide_a_basic_sut_constructor_argument((Action<Rover>) (x => x.turn_left()));
25                        };
26
27        because b = () => sut.run_against(rover);
28
29        static Rover rover;
30    }
31
32    public class when_checking_if_a_navigation_knows_how_to_process_input_from_nasa :
33        observations_for_a_sut_without_a_contract<Navigation>
34    {
35        context c = () =>
36                        {
37                            code = 'l';
38                            provide_a_basic_sut_constructor_argument(code);
39                        };
40
41        static protected char code;
42    }
43
44    public class when_input_is_recognized : when_checking_if_a_navigation_knows_how_to_process_input_from_nasa
45    {
46        it should_return_true = () => result.should_be_equal_to(true);
47
48        because b = () => { result = sut.is_satisfied_by(char.ToUpperInvariant(code)); };
49
50        static bool result;
51    }
52
53    public class when_input_is_not_recognized : when_checking_if_a_navigation_knows_how_to_process_input_from_nasa
54    {
55        it should_return_false = () => result.should_be_equal_to(false);
56
57        because b = () => { result = sut.is_satisfied_by('M'); };
58
59        static bool result;
60    }
61}