main
 1using System.Reflection;
 2using MbUnit.Framework;
 3using Spec.Dox.Test;
 4using Spec.Dox.Test.Extensions;
 5using Spec.Dox.Test.MetaData;
 6using Spec.Dox.Utility.Core;
 7
 8namespace Spec.Dox.Domain
 9{
10    public class MethodDecoratedBySpecificationAttributeSpecs {}
11
12    [Concern(typeof (MethodIsDecoratedBySpecificationAttribute))]
13    public class when_checking_if_a_method_is_decorated_with_an_attribute_that_it_is_decorated_with :
14        context_spec<ISpecification<MethodInfo>>
15    {
16        bool result;
17        MethodInfo methodToInspect;
18
19        protected override ISpecification<MethodInfo> EstablishContext()
20        {
21            methodToInspect = GetType().GetMethod("should_return_true");
22            return new MethodIsDecoratedBySpecificationAttribute("TestAttribute");
23        }
24
25        protected override void Because()
26        {
27            result = sut.IsSatisfiedBy(methodToInspect);
28        }
29
30        [Test]
31        public void should_return_true()
32        {
33            result.should_be_equal_to(true);
34        }
35    }
36
37    [Concern(typeof (MethodIsDecoratedBySpecificationAttribute))]
38    public class when_checking_if_a_method_is_decorated_with_an_attribute_that_it_is_not :
39        context_spec<ISpecification<MethodInfo>>
40    {
41        bool result;
42        MethodInfo methodToInspect;
43
44        protected override ISpecification<MethodInfo> EstablishContext()
45        {
46            methodToInspect = GetType().GetMethod("should_return_false");
47            return new MethodIsDecoratedBySpecificationAttribute("SerializableAttribute");
48        }
49
50        protected override void Because()
51        {
52            result = sut.IsSatisfiedBy(methodToInspect);
53        }
54
55        [Test]
56        public void should_return_false()
57        {
58            result.should_be_equal_to(false);
59        }
60    }
61}