summaryrefslogtreecommitdiff
path: root/spec/unit/utility/MappingExtensionsSpecs.cs
blob: fce8ff1ccdaf70338b07a91fac2ccb57a9118261 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using gorilla.utility;
using Machine.Specifications;

namespace specs.unit.utility
{
    [Subject(typeof (MappingExtensions))]
    public class when_transforming_type_A_to_type_B_then_C
    {
        It should_return_the_correct_result = () => result.should_be_equal_to(1);

        Establish c = () =>
        {
            first_mapper = Create.an<Mapper<object, string>>();
            second_mapper = Create.an<Mapper<string, int>>();
            a = 1;

            first_mapper.is_told_to(x => x.map_from(a)).it_will_return("1");
            second_mapper.is_told_to(x => x.map_from("1")).it_will_return(1);
        };

        Because b = () =>
        {
            result = first_mapper.then(second_mapper).map_from(a);
        };


        static int result;
        static Mapper<object, string> first_mapper;
        static Mapper<string, int> second_mapper;
        static object a;
    }
}