private void NoFailures(string name, EHErrorInjector injector)
        {
            TestState state = new TestState();

            state.Initialize(name, 1, 0);

            ServiceFabricProcessor sfp = new ServiceFabricProcessor(
                state.ServiceUri,
                state.ServicePartitionId,
                state.StateManager,
                state.StatefulServicePartition,
                state.Processor,
                state.ConnectionString,
                "$Default",
                state.Options);

            sfp.MockMode = state.PartitionLister;
            sfp.EventHubClientFactory = new InjectorEventHubClientFactoryMock(1, injector);

            state.PrepareToRun();
            state.StartRun(sfp);

            state.RunForNBatches(20, 10);

            // EXPECTED RESULT: Processing should happen normally with no errors reported.
            //
            // 1) The error is transient, so it should be retried, and for "soft" errors the
            // test harness only throws on the first call, so the retry will succeed.
            //
            // 2) Errors during shutdown are traced but ignored.
            state.WaitRun();

            Assert.True(state.Processor.TotalBatches >= 20, $"Run ended at {state.Processor.TotalBatches} batches");
            Assert.True(state.Processor.TotalErrors == 0, $"Errors found {state.Processor.TotalErrors}");
            Assert.Null(state.ShutdownException);
        }
 public InjectorEventHubClientMock(int partitionCount, EventHubsConnectionStringBuilder csb, EHErrorInjector injector) :
     base(partitionCount, csb, InjectorEventHubClientFactoryMock.Tag)
 {
     this.injector = injector;
 }
 public InjectorEventHubClientFactoryMock(int partitionCount, EHErrorInjector injector) : base(partitionCount,
                                                                                               InjectorEventHubClientFactoryMock.Tag)
 {
     this.injector = injector;
 }
 public InjectorPartitionReceiverMock(string partitionId, long sequenceNumber, CancellationToken token,
                                      TimeSpan pumpTimeout, ReceiverOptions options, EHErrorInjector injector) :
     base(partitionId, sequenceNumber, token, pumpTimeout, options, InjectorEventHubClientFactoryMock.Tag)
 {
     this.injector = injector;
 }