public void EventActionWithoutArguments_AnnotatedWithOnEventInterceptionAspect_ReturnsTheCorrectSequenceOfAdvices()
        {
            var instance = container.Resolve<IEventActionWithoutArgumentsComposite>();
            var joinPoints = new EventInterceptionAspectOrderedJoinPoints();
            Action action = () => instance.Values.Add(AspectJoinPoints.Intercepted);

            instance.InterceptionAspect += action;
            instance.RaiseInterceptionAspect();
            instance.InterceptionAspect -= action;
            instance.RaiseInterceptionAspect();

            CollectionAssert.AreEqual(instance.Values, joinPoints);
        }
        public void EventActionWith1Argument_AnnotatedWithOnEventInterceptionAspect_ReturnsTheCorrectSequenceOfAdvices()
        {
            var firstList = new List<AspectJoinPoints>();
            var secondList = new List<AspectJoinPoints>();
            var instance = container.Resolve<IEventActionWith1ArgumentComposite>();
            var joinPoints = new EventInterceptionAspectOrderedJoinPoints();
            Action<List<AspectJoinPoints>> action = l => instance.Values.Append(AspectJoinPoints.Intercepted);

            instance.InterceptionAspect += action;
            instance.RaiseInterceptionAspect(firstList);
            instance.InterceptionAspect -= action;
            instance.RaiseInterceptionAspect(secondList);

            CollectionAssert.AreEqual(firstList, new EventInterceptionInvokeAspectOrderedJoinPoints());
            CollectionAssert.AreEqual(secondList, AspectOrderedJoinPoints.Empty);
            CollectionAssert.AreEqual(instance.Values, joinPoints);
        }
        public void EventActionWith5Arguments_AnnotatedWithOnEventInterceptionAspect_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 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 instance = container.Resolve<IEventActionWith5ArgumentsComposite>();
            var joinPoints = new EventInterceptionAspectOrderedJoinPoints();
            Action<List<AspectJoinPoints>, List<AspectJoinPoints>, List<AspectJoinPoints>, List<AspectJoinPoints>, List<AspectJoinPoints>> action = (l1, l2, l3, l4, l5) => instance.Values.Append(AspectJoinPoints.Intercepted);

            instance.InterceptionAspect += action;
            instance.RaiseInterceptionAspect(firstArg1List, firstArg2List, firstArg3List, firstArg4List, firstArg5List);
            instance.InterceptionAspect -= action;
            instance.RaiseInterceptionAspect(secondArg1List, secondArg2List, secondArg3List, secondArg4List, secondArg5List);

            CollectionAssertExt.AreAllEqual(new EventInterceptionInvokeAspectOrderedJoinPoints(), firstArg1List, firstArg2List, firstArg3List, firstArg4List, firstArg5List);
            CollectionAssertExt.AreAllEqual(AspectOrderedJoinPoints.Empty, secondArg1List, secondArg2List, secondArg3List, secondArg4List, secondArg5List);
            CollectionAssert.AreEqual(instance.Values, joinPoints);
        }
        public void EventFunctionWith7Arguments_AnnotatedWithOnEventInterceptionAspect_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 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<IEventFunctionWith7ArgumentsComposite>();
            var joinPoints = new EventInterceptionAspectOrderedJoinPoints();
            Func<List<AspectJoinPoints>, List<AspectJoinPoints>, List<AspectJoinPoints>, List<AspectJoinPoints>, List<AspectJoinPoints>, List<AspectJoinPoints>, List<AspectJoinPoints>, string> func = (l1, l2, l3, l4, l5,  l6,  l7) => instance.Values.Append(AspectJoinPoints.Intercepted).ToString();

            instance.InterceptionAspect += func;
            firstResult = instance.RaiseInterceptionAspect(firstArg1List, firstArg2List, firstArg3List, firstArg4List, firstArg5List, firstArg6List, firstArg7List);
            instance.InterceptionAspect -= func;
            secondResult = instance.RaiseInterceptionAspect(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);
            Assert.AreEqual(firstResult, AspectJoinPoints.Intercepted.ToString());
            Assert.AreEqual(secondResult, AspectJoinPoints.NoEvent.ToString());
        }
        public void EventFunctionWithoutArguments_AnnotatedWithOnEventInterceptionAspect_ReturnsTheCorrectSequenceOfAdvices()
        {
            List<AspectJoinPoints> firstResult = null;
            List<AspectJoinPoints> secondResult = null;
            var instance = container.Resolve<IEventFunctionWithoutArgumentsComposite>();
            var joinPoints = new EventInterceptionAspectOrderedJoinPoints();
            Func<List<AspectJoinPoints>> func = () => {
                instance.Values.Add(AspectJoinPoints.Intercepted);

                return instance.Values;
            };

            instance.InterceptionAspect += func;
            firstResult = instance.RaiseInterceptionAspect();
            instance.InterceptionAspect -= func;
            secondResult = instance.RaiseInterceptionAspect();

            CollectionAssert.AreEqual(instance.Values, joinPoints);
            CollectionAssert.AreEqual(firstResult, joinPoints);
            CollectionAssert.AreEqual(secondResult, AspectOrderedJoinPoints.Empty);
        }
        public void EventFunctionWith1Argument_AnnotatedWithOnEventInterceptionAspect_ReturnsTheCorrectSequenceOfAdvices()
        {
            string firstResult = null;
            string secondResult = null;
            var firstList = new List<AspectJoinPoints>();
            var secondList = new List<AspectJoinPoints>();
            var instance = container.Resolve<IEventFunctionWith1ArgumentComposite>();
            var joinPoints = new EventInterceptionAspectOrderedJoinPoints();
            Func<List<AspectJoinPoints>, string> func = l => instance.Values.Append(AspectJoinPoints.Intercepted).ToString();

            instance.InterceptionAspect += func;
            firstResult = instance.RaiseInterceptionAspect(firstList);
            instance.InterceptionAspect -= func;
            secondResult = instance.RaiseInterceptionAspect(secondList);

            CollectionAssert.AreEqual(firstList, new EventInterceptionInvokeAspectOrderedJoinPoints());
            CollectionAssert.AreEqual(secondList, AspectOrderedJoinPoints.Empty);
            CollectionAssert.AreEqual(instance.Values, joinPoints);
            Assert.AreEqual(firstResult, AspectJoinPoints.Intercepted.ToString());
            Assert.AreEqual(secondResult, AspectJoinPoints.NoEvent.ToString());
        }