Beispiel #1
0
        internal Nodule(string name, ICustomAttributeProvider attrprov)
        {
            this.name  = name;
            this.upper = name.ToUpper();

            // either methodinfo or typeinfo
            if (attrprov == null)
            {
                attrprov = GetType().GetTypeInfo();
            }

            // ui
            var uis = (UiAttribute[])attrprov.GetCustomAttributes(typeof(UiAttribute), false);

            if (uis.Length > 0)
            {
                ui = uis[0];
            }

            // authorize
            var auths = (AuthorizeAttribute[])attrprov.GetCustomAttributes(typeof(AuthorizeAttribute), false);

            if (auths.Length > 0)
            {
                authorize        = auths[0];
                authorize.Nodule = this;
            }

            // filters
            var attrs = attrprov.GetCustomAttributes(false);

            for (int i = 0; i < attrs.Length; i++)
            {
                var a = attrs[i];
                if (a is IBefore)
                {
                    before = (IBefore)a;
                }
                if (a is IBeforeAsync)
                {
                    beforeAsync = (IBeforeAsync)a;
                }
                if (a is IAfter)
                {
                    after = (IAfter)a;
                }
                if (a is IAfterAsync)
                {
                    afterAsync = (IAfterAsync)a;
                }
            }
        }
 public OrderingExpectationTest()
 {
     this.mockBefore = MockRepository.GenerateStub<IBefore>();
       this.mockAfter = MockRepository.GenerateStub<IAfter>();
 }