main
 1using Machine.Specifications;
 2using solidware.financials.service.domain.accounting;
 3
 4namespace specs.unit.service.domain.accounting
 5{
 6    public class CurrencySpecs
 7    {
 8        public abstract class concern 
 9        {
10            Cleanup clean = () =>
11            {
12                SimpleUnitOfMeasure.provide_rate((x, y) => ConversionRatio.Default);
13            };
14        }
15
16        [Concern(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.05690034m));
22            };
23
24            It should_return_the_correct_amount = () =>
25            {
26                Currency.USD.convert(1, Currency.CAD).should_be_equal_to(1.05690034m);
27            };
28        }
29
30        [Concern(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.95057m));
36            };
37
38            It should_return_the_correct_amount = () =>
39            {
40                Currency.CAD.convert(1.05690034m, Currency.USD).should_be_equal_to(1.0046577561938m);
41            };
42        }
43    }
44}