public void EventFunctionWith3Arguments_AnnotatedWithMultipleOnEventInterceptionAspectWhichCallsInvokeHanlder_IgnoresAllFollowingAspectsAndReturnsTheCorrectValue()
        {
            string firstResult = null;
            string secondResult = null;
            var firstArg1List = new List<AspectJoinPoints>();
            var firstArg2List = new List<AspectJoinPoints>();
            var firstArg3List = new List<AspectJoinPoints>();
            var secondArg1List = new List<AspectJoinPoints>();
            var secondArg2List = new List<AspectJoinPoints>();
            var secondArg3List = new List<AspectJoinPoints>();
            var instance = container.Resolve<IEventFunctionWith3ArgumentsComposite>();
            var joinPoints = new MultipleIgnoredEventInterceptionAspectOrderedJoinPoints();
            Func<List<AspectJoinPoints>, List<AspectJoinPoints>, List<AspectJoinPoints>, string> func = (l1, l2, l3) => {
                return instance.Values.Append(AspectJoinPoints.Intercepted).ToString();
            };

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

            CollectionAssertExt.AreAllEqual(new EventInterceptionInvokeAspectOrderedJoinPoints(), firstArg1List, firstArg2List, firstArg3List);
            CollectionAssertExt.AreAllEqual(AspectOrderedJoinPoints.Empty, secondArg1List, secondArg2List, secondArg3List);
            CollectionAssert.AreEqual(instance.Values, joinPoints);
            Assert.AreEqual(firstResult, AspectJoinPoints.Intercepted.ToString());
            Assert.AreEqual(secondResult, AspectJoinPoints.NoEvent.ToString());
        }
        public void EventActionWithoutArguments_AnnotatedWithMultipleOnEventInterceptionAspectWhichCallsInvokeHanlder_IgnoresAllFollowingAspectsAndReturnsTheCorrectValue()
        {
            var    instance   = container.Resolve <IEventActionWithoutArgumentsComposite>();
            var    joinPoints = new MultipleIgnoredEventInterceptionAspectOrderedJoinPoints();
            Action action     = () => instance.Values.Add(AspectJoinPoints.Intercepted);

            instance.MultipleIgnoredInterceptionAspects += action;
            instance.RaiseMultipleIgnoredInterceptionAspects();
            instance.MultipleIgnoredInterceptionAspects -= action;
            instance.RaiseMultipleIgnoredInterceptionAspects();

            CollectionAssert.AreEqual(instance.Values, joinPoints);
        }
예제 #3
0
        public void EventActionWith1Argument_AnnotatedWithMultipleOnEventInterceptionAspectWhichCallsInvokeHanlder_IgnoresAllFollowingAspectsAndReturnsTheCorrectValue()
        {
            var firstList  = new List <AspectJoinPoints>();
            var secondList = new List <AspectJoinPoints>();
            var instance   = container.Resolve <IEventActionWith1ArgumentComposite>();
            var joinPoints = new MultipleIgnoredEventInterceptionAspectOrderedJoinPoints();
            Action <List <AspectJoinPoints> > action = l => instance.Values.Append(AspectJoinPoints.Intercepted);

            instance.MultipleIgnoredInterceptionAspects += action;
            instance.RaiseMultipleIgnoredInterceptionAspects(firstList);
            instance.MultipleIgnoredInterceptionAspects -= action;
            instance.RaiseMultipleIgnoredInterceptionAspects(secondList);

            CollectionAssert.AreEqual(firstList, new EventInterceptionInvokeAspectOrderedJoinPoints());
            CollectionAssert.AreEqual(secondList, AspectOrderedJoinPoints.Empty);
            CollectionAssert.AreEqual(instance.Values, joinPoints);
        }
예제 #4
0
        public void EventFunctionWithoutArguments_AnnotatedWithMultipleOnEventInterceptionAspectWhichCallsInvokeHanlder_IgnoresAllFollowingAspectsAndReturnsTheCorrectValue()
        {
            List <AspectJoinPoints> firstResult  = null;
            List <AspectJoinPoints> secondResult = null;
            var instance   = container.Resolve <IEventFunctionWithoutArgumentsComposite>();
            var joinPoints = new MultipleIgnoredEventInterceptionAspectOrderedJoinPoints();
            Func <List <AspectJoinPoints> > func = () => {
                instance.Values.Add(AspectJoinPoints.Intercepted);

                return(instance.Values);
            };

            instance.MultipleIgnoredInterceptionAspects += func;
            firstResult = instance.RaiseMultipleIgnoredInterceptionAspects();
            instance.MultipleIgnoredInterceptionAspects -= func;
            secondResult = instance.RaiseMultipleIgnoredInterceptionAspects();

            CollectionAssert.AreEqual(instance.Values, joinPoints);
            CollectionAssert.AreEqual(firstResult, joinPoints);
            CollectionAssert.AreEqual(secondResult, AspectOrderedJoinPoints.Empty);
        }