public async Task AcknowledgeCallsInnerMessageAcknowledgeIfAcknowledgeForwarderIsNull() { using var receiver = new FakeReceiver(); using var forwardingReceiver = new ForwardingReceiver("foo", receiver, acknowledgeForwarder: null); using var message = new FakeReceiverMessage("Hello, world!"); var forwardingMessage = new ForwardingReceiverMessage(forwardingReceiver, message); await forwardingMessage.AcknowledgeAsync().ConfigureAwait(false); message.HandledBy.Should().Be(nameof(IReceiverMessage.AcknowledgeAsync)); }
public async Task AcknowledgeHandlesInnerMessageAccordingToAcknowledgeOutcomeWhenAcknowledgeForwarderIsNotNull(ForwardingOutcome outcome) { using var forwarder = new FakeSender(); using var receiver = new FakeReceiver(); using var forwardingReceiver = new ForwardingReceiver("foo", receiver, acknowledgeForwarder: forwarder, acknowledgeOutcome: outcome); using var message = new FakeReceiverMessage("Hello, world!"); var forwardingMessage = new ForwardingReceiverMessage(forwardingReceiver, message); await forwardingMessage.AcknowledgeAsync().ConfigureAwait(false); message.HandledBy.Should().Be($"{outcome}Async"); }
public async Task AcknowledgeSendsMessageToAcknowledgeForwarderWhenAcknowledgeForwarderIsNotNull() { using var forwarder = new FakeSender(); using var receiver = new FakeReceiver(); using var forwardingReceiver = new ForwardingReceiver("foo", receiver, acknowledgeForwarder: forwarder); using var message = new FakeReceiverMessage("Hello, world!"); var forwardingMessage = new ForwardingReceiverMessage(forwardingReceiver, message); await forwardingMessage.AcknowledgeAsync().ConfigureAwait(false); forwarder.SentMessages.Should().ContainSingle(); forwarder.SentMessages[0].StringPayload.Should().Be("Hello, world!"); }