public void EventFunctionWith6Arguments_AnnotatedWithMultipleOnEventInterceptionAspect_ReturnsTheCorrectSequenceOfAdvices()
        {
            string firstResult    = null;
            string secondResult   = null;
            var    firstArg1List  = new List <AspectJoinPoints>();
            var    firstArg2List  = new List <AspectJoinPoints>();
            var    firstArg3List  = new List <AspectJoinPoints>();
            var    firstArg4List  = new List <AspectJoinPoints>();
            var    firstArg5List  = new List <AspectJoinPoints>();
            var    firstArg6List  = new List <AspectJoinPoints>();
            var    secondArg1List = new List <AspectJoinPoints>();
            var    secondArg2List = new List <AspectJoinPoints>();
            var    secondArg3List = new List <AspectJoinPoints>();
            var    secondArg4List = new List <AspectJoinPoints>();
            var    secondArg5List = new List <AspectJoinPoints>();
            var    secondArg6List = new List <AspectJoinPoints>();
            var    instance       = container.Resolve <IEventFunctionWith6ArgumentsComposite>();
            var    joinPoints     = new MultipleEventInterceptionAspectOrderedJoinPoints();
            Func <List <AspectJoinPoints>, List <AspectJoinPoints>, List <AspectJoinPoints>, List <AspectJoinPoints>, List <AspectJoinPoints>, List <AspectJoinPoints>, string> func = (l1, l2, l3, l4, l5, l6) => instance.Values.Append(AspectJoinPoints.Intercepted).ToString();

            instance.MultipleInterceptionAspects += func;
            firstResult = instance.RaiseMultipleInterceptionAspect(firstArg1List, firstArg2List, firstArg3List, firstArg4List, firstArg5List, firstArg6List);
            instance.MultipleInterceptionAspects -= func;
            secondResult = instance.RaiseMultipleInterceptionAspect(secondArg1List, secondArg2List, secondArg3List, secondArg4List, secondArg5List, secondArg6List);

            CollectionAssertExt.AreAllEqual(new EventMultipleInterceptionInvokeAspectOrderedJoinPoints(), firstArg1List, firstArg2List, firstArg3List, firstArg4List, firstArg5List, firstArg6List);
            CollectionAssertExt.AreAllEqual(AspectOrderedJoinPoints.Empty, secondArg1List, secondArg2List, secondArg3List, secondArg4List, secondArg5List, secondArg6List);
            CollectionAssert.AreEqual(instance.Values, joinPoints);
            Assert.AreEqual(firstResult, AspectJoinPoints.Intercepted.ToString());
            Assert.AreEqual(secondResult, AspectJoinPoints.NoEvent.ToString());
        }
        public void EventFunctionWith4Arguments_AnnotatedWithMultipleOnEventInterceptionAspectWhichCallsInvokeHanlder_IgnoresAllFollowingAspectsAndReturnsTheCorrectValue()
        {
            string firstResult    = null;
            string secondResult   = null;
            var    firstArg1List  = new List <AspectJoinPoints>();
            var    firstArg2List  = new List <AspectJoinPoints>();
            var    firstArg3List  = new List <AspectJoinPoints>();
            var    firstArg4List  = new List <AspectJoinPoints>();
            var    secondArg1List = new List <AspectJoinPoints>();
            var    secondArg2List = new List <AspectJoinPoints>();
            var    secondArg3List = new List <AspectJoinPoints>();
            var    secondArg4List = new List <AspectJoinPoints>();
            var    instance       = container.Resolve <IEventFunctionWith4ArgumentsComposite>();
            var    joinPoints     = new MultipleIgnoredEventInterceptionAspectOrderedJoinPoints();
            Func <List <AspectJoinPoints>, List <AspectJoinPoints>, List <AspectJoinPoints>, List <AspectJoinPoints>, string> func = (l1, l2, l3, l4) => {
                return(instance.Values.Append(AspectJoinPoints.Intercepted).ToString());
            };

            instance.MultipleIgnoredInterceptionAspects += func;
            firstResult = instance.RaiseMultipleIgnoredInterceptionAspects(firstArg1List, firstArg2List, firstArg3List, firstArg4List);
            instance.MultipleIgnoredInterceptionAspects -= func;
            secondResult = instance.RaiseMultipleIgnoredInterceptionAspects(secondArg1List, secondArg2List, secondArg3List, secondArg4List);

            CollectionAssertExt.AreAllEqual(new EventInterceptionInvokeAspectOrderedJoinPoints(), firstArg1List, firstArg2List, firstArg3List, firstArg4List);
            CollectionAssertExt.AreAllEqual(AspectOrderedJoinPoints.Empty, secondArg1List, secondArg2List, secondArg3List, secondArg4List);
            CollectionAssert.AreEqual(instance.Values, joinPoints);
            Assert.AreEqual(firstResult, AspectJoinPoints.Intercepted.ToString());
            Assert.AreEqual(secondResult, AspectJoinPoints.NoEvent.ToString());
        }
        public void EventActionWith6Arguments_AnnotatedWithMultipleOnEventInterceptionAspect_ReturnsTheCorrectSequenceOfAdvices()
        {
            var firstArg1List  = new List <AspectJoinPoints>();
            var firstArg2List  = new List <AspectJoinPoints>();
            var firstArg3List  = new List <AspectJoinPoints>();
            var firstArg4List  = new List <AspectJoinPoints>();
            var firstArg5List  = new List <AspectJoinPoints>();
            var firstArg6List  = new List <AspectJoinPoints>();
            var secondArg1List = new List <AspectJoinPoints>();
            var secondArg2List = new List <AspectJoinPoints>();
            var secondArg3List = new List <AspectJoinPoints>();
            var secondArg4List = new List <AspectJoinPoints>();
            var secondArg5List = new List <AspectJoinPoints>();
            var secondArg6List = new List <AspectJoinPoints>();
            var instance       = container.Resolve <IEventActionWith6ArgumentsComposite>();
            var joinPoints     = new MultipleEventInterceptionAspectOrderedJoinPoints();
            Action <List <AspectJoinPoints>, List <AspectJoinPoints>, List <AspectJoinPoints>, List <AspectJoinPoints>, List <AspectJoinPoints>, List <AspectJoinPoints> > action = (l1, l2, l3, l4, l5, l6) => instance.Values.Append(AspectJoinPoints.Intercepted);

            instance.MultipleInterceptionAspects += action;
            instance.RaiseMultipleInterceptionAspect(firstArg1List, firstArg2List, firstArg3List, firstArg4List, firstArg5List, firstArg6List);
            instance.MultipleInterceptionAspects -= action;
            instance.RaiseMultipleInterceptionAspect(secondArg1List, secondArg2List, secondArg3List, secondArg4List, secondArg5List, secondArg6List);

            CollectionAssertExt.AreAllEqual(new EventMultipleInterceptionInvokeAspectOrderedJoinPoints(), firstArg1List, firstArg2List, firstArg3List, firstArg4List, firstArg5List, firstArg6List);
            CollectionAssertExt.AreAllEqual(AspectOrderedJoinPoints.Empty, secondArg1List, secondArg2List, secondArg3List, secondArg4List, secondArg5List, secondArg6List);
            CollectionAssert.AreEqual(instance.Values, joinPoints);
        }
Пример #4
0
        public void EventActionWith7Arguments_AnnotatedWithMultipleOnEventInterceptionAspectWhichCallsInvokeHanlder_IgnoresAllFollowingAspectsAndReturnsTheCorrectValue()
        {
            var firstArg1List  = new List <AspectJoinPoints>();
            var firstArg2List  = new List <AspectJoinPoints>();
            var firstArg3List  = new List <AspectJoinPoints>();
            var firstArg4List  = new List <AspectJoinPoints>();
            var firstArg5List  = new List <AspectJoinPoints>();
            var firstArg6List  = new List <AspectJoinPoints>();
            var firstArg7List  = new List <AspectJoinPoints>();
            var secondArg1List = new List <AspectJoinPoints>();
            var secondArg2List = new List <AspectJoinPoints>();
            var secondArg3List = new List <AspectJoinPoints>();
            var secondArg4List = new List <AspectJoinPoints>();
            var secondArg5List = new List <AspectJoinPoints>();
            var secondArg6List = new List <AspectJoinPoints>();
            var secondArg7List = new List <AspectJoinPoints>();
            var instance       = container.Resolve <IEventActionWith7ArgumentsComposite>();
            var joinPoints     = new MultipleIgnoredEventInterceptionAspectOrderedJoinPoints();
            Action <List <AspectJoinPoints>, List <AspectJoinPoints>, List <AspectJoinPoints>, List <AspectJoinPoints>, List <AspectJoinPoints>, List <AspectJoinPoints>, List <AspectJoinPoints> > action = (l1, l2, l3, l4, l5, l6, l7) => instance.Values.Append(AspectJoinPoints.Intercepted);

            instance.MultipleIgnoredInterceptionAspects += action;
            instance.RaiseMultipleIgnoredInterceptionAspects(firstArg1List, firstArg2List, firstArg3List, firstArg4List, firstArg5List, firstArg6List, firstArg7List);
            instance.MultipleIgnoredInterceptionAspects -= action;
            instance.RaiseMultipleIgnoredInterceptionAspects(secondArg1List, secondArg2List, secondArg3List, secondArg4List, secondArg5List, secondArg6List, secondArg7List);

            CollectionAssertExt.AreAllEqual(new EventInterceptionInvokeAspectOrderedJoinPoints(), firstArg1List, firstArg2List, firstArg3List, firstArg4List, firstArg5List, firstArg6List, firstArg7List);
            CollectionAssertExt.AreAllEqual(AspectOrderedJoinPoints.Empty, secondArg1List, secondArg2List, secondArg3List, secondArg4List, secondArg5List, secondArg6List, secondArg7List);
            CollectionAssert.AreEqual(instance.Values, joinPoints);
        }