main
 1using gorilla.commons.utility;
 2
 3namespace tests.unit.commons.utility
 4{
 5    public class OrSpecificationSpecs
 6    {
 7        [Concern(typeof (OrSpecification<>))]
 8        public abstract class when_checking_if_one_of_two_conditions_are_met : TestsFor<Specification<int>>
 9        {
10            public override Specification<int> create_sut()
11            {
12                return new OrSpecification<int>(left, right);
13            }
14
15            context c = () =>
16            {
17                left = an<Specification<int>>();
18                right = an<Specification<int>>();
19            };
20
21            static protected Specification<int> left;
22            static protected Specification<int> right;
23        }
24
25        [Concern(typeof (OrSpecification<>))]
26        public class when_one_of_the_conditions_is_met : when_checking_if_one_of_two_conditions_are_met
27        {
28            it should_return_true = () => result.should_be_true();
29
30            context c = () => left.is_told_to(x => x.is_satisfied_by(1)).it_will_return(true);
31
32            because b = () =>
33            {
34                result = sut.is_satisfied_by(1);
35            };
36
37            static bool result;
38        }
39
40        [Concern(typeof (OrSpecification<>))]
41        public class when_the_second_condition_is_met : when_checking_if_one_of_two_conditions_are_met
42        {
43            it should_return_true = () => result.should_be_true();
44
45            context c = () => right.is_told_to(x => x.is_satisfied_by(1)).it_will_return(true);
46
47            because b = () =>
48            {
49                result = sut.is_satisfied_by(1);
50            };
51
52            static bool result;
53        }
54
55        [Concern(typeof (OrSpecification<>))]
56        public class when_neither_conditions_are_met : when_checking_if_one_of_two_conditions_are_met
57        {
58            it should_return_false = () => result.should_be_false();
59
60            because b = () =>
61            {
62                result = sut.is_satisfied_by(1);
63            };
64
65            static bool result;
66        }
67    }
68}