main
1using Machine.Specifications;
2using solidware.financials.windows.ui;
3
4namespace specs.unit.ui
5{
6 public class InMemoryApplicationStateSpecs
7 {
8 public abstract class concern
9 {
10 Establish context = () =>
11 {
12 sut = new InMemoryApplicationState();
13 };
14
15 static protected ApplicationState sut;
16 }
17
18 public class when_storing_something_in_memory : concern
19 {
20 It should_be_easy_to_pull_it_out_of_memory = () =>
21 {
22 result.ShouldEqual(token);
23 };
24
25 Because of = () =>
26 {
27 token = new TestToken();
28 sut.PushIn(token);
29 result = sut.PullOut<TestToken>();
30 };
31
32 static TestToken token;
33 static TestToken result;
34 }
35
36 public class when_checking_if_a_token_has_been_added : concern
37 {
38 It should_tell_you_when_it_has = () =>
39 {
40 sut.PushIn(new TestToken());
41 sut.HasBeenPushedIn<TestToken>().ShouldBeTrue();
42 };
43
44 It should_tell_you_when_it_has_NOT = () =>
45 {
46 sut.HasBeenPushedIn<string>().ShouldBeFalse();
47 };
48 }
49
50 class TestToken {}
51 }
52}