main
 1using gorilla.commons.utility;
 2
 3namespace tests.unit.commons.utility
 4{
 5    public class NotSpecificationSpecs
 6    {
 7        [Concern(typeof (NotSpecification<>))]
 8        public class when_checking_if_a_condition_is_not_met : TestsFor<Specification<int>>
 9        {
10            static protected Specification<int> criteria;
11
12            context c = () =>
13            {
14                criteria = dependency<Specification<int>>();
15            };
16
17            public override Specification<int> create_sut()
18            {
19                return new NotSpecification<int>(criteria);
20            }
21        }
22
23        [Concern(typeof (NotSpecification<>))]
24        public class when_a_condition_is_not_met : when_checking_if_a_condition_is_not_met
25        {
26            context c = () => criteria.is_told_to(x => x.is_satisfied_by(1)).it_will_return(false);
27
28            because b = () =>
29            {
30                result = sut.is_satisfied_by(1);
31            };
32
33            it should_return_true = () => result.should_be_true();
34
35            static bool result;
36        }
37
38        [Concern(typeof (NotSpecification<>))]
39        public class when_a_condition_is_met : when_checking_if_a_condition_is_not_met
40        {
41            context c = () => criteria.is_told_to(x => x.is_satisfied_by(1)).it_will_return(true);
42
43            because b = () =>
44            {
45                result = sut.is_satisfied_by(1);
46            };
47
48            it should_return_false = () => result.should_be_false();
49
50            static bool result;
51        }
52    }
53}