예제 #1
0
        public void    CanPassOnRemovedProcessedEvents()
        {
            //Arrange
            var join = new TestAbstractJoinOperation();
            var op1  = MockRepository.GenerateMock <IOperation>();
            var op2  = MockRepository.GenerateMock <IOperation>();

            join.Left(op1).Right(op2);

            op1.Expect(x => x.OnRowProcessed += processAction);
            op1.Expect(x => x.OnRowProcessed -= processAction);
            op2.Expect(x => x.OnRowProcessed += processAction);
            op2.Expect(x => x.OnRowProcessed -= processAction);

            //Act
            join.OnRowProcessed += processAction;
            join.OnRowProcessed -= processAction;

            //Assert
            op1.VerifyAllExpectations();
            op2.VerifyAllExpectations();

            var handlerInfos = typeof(AbstractOperation).GetField("OnRowProcessed", BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic);

            Assert.Single(((Delegate)(handlerInfos.GetValue(join))).GetInvocationList());
        }
예제 #2
0
        public void CanPassOnAddedFinishedEvents()
        {
            var join = new TestAbstractJoinOperation();
            var op1  = Substitute.For <IOperation>();
            var op2  = Substitute.For <IOperation>();

            join.Left(op1).Right(op2);

            join.OnFinishedProcessing += finishedAction;

            op1.Received().OnFinishedProcessing += finishedAction;
            op2.Received().OnFinishedProcessing += finishedAction;

            Assert.Equal(2, GetEventHandlers(join, nameof(join.OnFinishedProcessing)).Length);
        }
예제 #3
0
        public void CanPassOnAddedProcessedEvents()
        {
            //Arrange
            var join = new TestAbstractJoinOperation();
            var op1  = Substitute.For <IOperation>();
            var op2  = Substitute.For <IOperation>();

            join.Left(op1).Right(op2);

            //Act
            join.OnRowProcessed += processAction;

            //Assert
            op1.Received(1).OnRowProcessed += processAction;
            op2.Received(1).OnRowProcessed += processAction;

            Assert.Equal(2, GetEventHandlers(join, nameof(join.OnRowProcessed)).Length);
        }
예제 #4
0
        public void    CanPassOnAddedFinishedEvents()
        {
            var    join = new TestAbstractJoinOperation();
            var    op1    = MockRepository.GenerateMock<IOperation>();
            var    op2    = MockRepository.GenerateMock<IOperation>();
            join.Left(op1).Right(op2);

            op1.Expect(x =>    x.OnFinishedProcessing += finishedAction);
            op2.Expect(x =>    x.OnFinishedProcessing += finishedAction);

            join.OnFinishedProcessing += finishedAction;

            op1.VerifyAllExpectations();
            op2.VerifyAllExpectations();

            var    handlerInfos = typeof(AbstractOperation).GetField("OnFinishedProcessing", BindingFlags.Static |    BindingFlags.Instance |    BindingFlags.NonPublic);
            Assert.Equal(2,    ((Delegate)(handlerInfos.GetValue(join))).GetInvocationList().Length);
        }
예제 #5
0
        public void    CanPassOnAddedFinishedEvents()
        {
            var join = new TestAbstractJoinOperation();
            var op1  = MockRepository.GenerateMock <IOperation>();
            var op2  = MockRepository.GenerateMock <IOperation>();

            join.Left(op1).Right(op2);

            op1.Expect(x => x.OnFinishedProcessing += finishedAction);
            op2.Expect(x => x.OnFinishedProcessing += finishedAction);

            join.OnFinishedProcessing += finishedAction;

            op1.VerifyAllExpectations();
            op2.VerifyAllExpectations();

            var handlerInfos = typeof(AbstractOperation).GetField("OnFinishedProcessing", BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic);

            Assert.Equal(2, ((Delegate)(handlerInfos.GetValue(join))).GetInvocationList().Length);
        }
예제 #6
0
        public void    CanPassOnRemovedProcessedEvents()
        {
            //Arrange
            var    join = new TestAbstractJoinOperation();
            var    op1    = MockRepository.GenerateMock<IOperation>();
            var    op2    = MockRepository.GenerateMock<IOperation>();
            join.Left(op1).Right(op2);

            op1.Expect(x =>    x.OnRowProcessed +=    processAction);
            op1.Expect(x =>    x.OnRowProcessed -=    processAction);
            op2.Expect(x =>    x.OnRowProcessed +=    processAction);
            op2.Expect(x =>    x.OnRowProcessed -=    processAction);

            //Act
            join.OnRowProcessed    += processAction;
            join.OnRowProcessed    -= processAction;

            //Assert
            op1.VerifyAllExpectations();
            op2.VerifyAllExpectations();

            var    handlerInfos = typeof(AbstractOperation).GetField("OnRowProcessed",    BindingFlags.Static    | BindingFlags.Instance    | BindingFlags.NonPublic);
            Assert.Equal(1,    ((Delegate)(handlerInfos.GetValue(join))).GetInvocationList().Length);
        }