public void CanHandle_Sequence_FalseReturned() { var policy = new MoveMessageErrorPolicy(TestProducerEndpoint.GetDefault()).Build(_serviceProvider); var envelope = new InboundEnvelope( "hey oh!", new MemoryStream(), null, new TestOffset(), new TestConsumerEndpoint("test") { Batch = new BatchSettings { Size = 10 } }, TestConsumerEndpoint.GetDefault().Name); var context = ConsumerPipelineContextHelper.CreateSubstitute(envelope, _serviceProvider); context.SetSequence(new BatchSequence("batch", context), false); var result = policy.CanHandle( context, new InvalidOperationException("test")); result.Should().BeFalse(); }
public void CanHandle_SingleMessage_TrueReturned() { var policy = new MoveMessageErrorPolicy(TestProducerEndpoint.GetDefault()).Build(_serviceProvider); var envelope = new InboundEnvelope( "hey oh!", new MemoryStream(), null, new TestOffset(), TestConsumerEndpoint.GetDefault(), TestConsumerEndpoint.GetDefault().Name); var result = policy.CanHandle( ConsumerPipelineContextHelper.CreateSubstitute(envelope, _serviceProvider), new InvalidOperationException("test")); result.Should().BeTrue(); }