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()); }
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); }
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); }
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); }
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); }
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); }