main
 1using gorilla.commons.utility;
 2
 3namespace tests.unit.commons.utility
 4{
 5    public class SpecificationExtensionsSpecs
 6    {
 7        public abstract class when_evaluating_two_conditions : concerns
 8        {
 9            context c = () =>
10            {
11                left = an<Specification<int>>();
12                right = an<Specification<int>>();
13            };
14
15            static protected Specification<int> left;
16            static protected Specification<int> right;
17        }
18
19        [Concern(typeof (SpecificationExtensions))]
20        public class when_checking_if_two_conditions_are_met_and_they_are : when_evaluating_two_conditions
21        {
22            it should_return_true = () => result.should_be_true();
23
24            context c = () =>
25            {
26                right.is_told_to(x => x.is_satisfied_by(1)).it_will_return(true);
27                left.is_told_to(x => x.is_satisfied_by(1)).it_will_return(true);
28            };
29
30            because b = () =>
31            {
32                result = left.or(right).is_satisfied_by(1);
33            };
34
35            static bool result;
36        }
37
38        [Concern(typeof (SpecificationExtensions))]
39        public class when_checking_if_one_of_two_conditions_are_met_and_the_left_one_is_not : when_evaluating_two_conditions
40        {
41            it should_return_true = () => result.should_be_true();
42
43            context c = () =>
44            {
45                right.is_told_to(x => x.is_satisfied_by(1)).it_will_return(true);
46                left.is_told_to(x => x.is_satisfied_by(1)).it_will_return(false);
47            };
48
49            because b = () =>
50            {
51                result = left.or(right).is_satisfied_by(1);
52            };
53
54            static bool result;
55        }
56
57        [Concern(typeof (SpecificationExtensions))]
58        public class when_checking_if_one_of_two_conditions_are_met_and_the_right_one_is_not :
59            when_evaluating_two_conditions
60        {
61            it should_return_true = () => result.should_be_true();
62
63            context c = () =>
64            {
65                right.is_told_to(x => x.is_satisfied_by(1)).it_will_return(false);
66                left.is_told_to(x => x.is_satisfied_by(1)).it_will_return(true);
67            };
68
69            because b = () =>
70            {
71                result = left.or(right).is_satisfied_by(1);
72            };
73
74            static bool result;
75        }
76    }
77}