main
1using Machine.Specifications;
2using presentation.windows.server.domain.accounting;
3
4namespace unit.server.domain.accounting
5{
6 public class CurrencySpecs
7 {
8 public abstract class concern
9 {
10 Cleanup cleanup = () =>
11 {
12 SimpleUnitOfMeasure.provide_rate((x, y) => ConversionRatio.Default);
13 };
14 }
15
16 [Subject(typeof (Currency))]
17 public class when_converting_one_USD_dollar_to_CAD : concern
18 {
19 Establish c = () =>
20 {
21 SimpleUnitOfMeasure.provide_rate((x, y) => new ConversionRatio(1.05690034));
22 };
23
24 It should_return_the_correct_amount = () =>
25 {
26 Currency.USD.convert(1, Currency.CAD).should_be_equal_to(1.05690034);
27 };
28 }
29
30 [Subject(typeof (Currency))]
31 public class when_converting_one_CAD_dollar_to_USD : concern
32 {
33 Establish c = () =>
34 {
35 SimpleUnitOfMeasure.provide_rate((x, y) => new ConversionRatio(0.95057));
36 };
37
38 It should_return_the_correct_amount = () =>
39 {
40 Currency.CAD.convert(1.05690034d, Currency.USD).should_be_equal_to(1.0046577561938002d);
41 };
42 }
43 }
44}