public void Should_set_the_onDeathlettering_when_called() { var sut = _sut(); Delegates.OnDeadLettering ex = async _ => await Delegates.DoNothing(); sut.With(onDeadLettering: ex); var result = sut.Build(); result.OnDeadLettering.Should().Be(ex); }
public void Should_set_the_onScheduled_when_called() { var sut = _sut(); Delegates.OnScheduling ex = async(_, __) => await Delegates.DoNothing(); sut.With(onScheduling: ex); var result = sut.Build(); result.OnScheduling.Should().Be(ex); }
public void Should_set_the_execution_when_called() { var sut = _sut(); Delegates.Execution ex = async() => await Delegates.DoNothing(); sut.With(execution: ex); var result = sut.Build(); result.Execution.Should().Be(ex); }
public void Should_set_the_onException_when_called() { var sut = _sut(); Delegates.OnException ex = async _ => await Delegates.DoNothing(); sut.With(onException: ex); var result = sut.Build(); result.OnException.Should().Be(ex); }
public async Task Should_handle_execution() { var exCount = 0; await ServiceBusPolicy.Apply() .WithMessage(_fixture.Msg) .WithSender(_fixture.MessageSender) .WithReceiver(_fixture.MessageReceiver) .WithLockToken(_fixture.LockToken) .RetryCount(2) .OnDeadLettering(async _ => { }) .OnException(async _ => exCount++) .OnScheduling(async(_, __) => { }) .ExecuteAsync(async() => await Delegates.DoNothing()); exCount.Should().Be(0); }