public async Task Handle_WithoutData_ReturnsFalse()
        {
            // Arrange
            var request = new DequeueCommand("fake_value", "E3A22C4F-BA71-4BC0-9571-85F7F906D20D");

            var warehouseDomainServiceMock = new Mock <IMarketOperatorDataDomainService>();

            warehouseDomainServiceMock.Setup(x => x.CanAcknowledgeAsync(
                                                 It.Is <LegacyActorId>(r => string.Equals(r.Value, request.MarketOperator, StringComparison.OrdinalIgnoreCase)),
                                                 It.Is <Uuid>(id => string.Equals(id.ToString(), request.BundleId, StringComparison.OrdinalIgnoreCase))))
            .ReturnsAsync((false, null));
            var dequeueNotificationSenderMock = new Mock <IDequeueNotificationSender>();
            var target = new DequeueHandler(
                warehouseDomainServiceMock.Object,
                dequeueNotificationSenderMock.Object,
                new Mock <ILogger>().Object,
                new Mock <ICorrelationContext>().Object);

            // Act
            var response = await target.Handle(request, CancellationToken.None).ConfigureAwait(false);

            // Assert
            Assert.NotNull(response);
            Assert.False(response.IsDequeued);
        }
        public async Task Handle_WithData_ReturnsTrue()
        {
            // Arrange
            var request           = new DequeueCommand("fake_value", "9FB4753A-0E2C-4F42-BA10-D38128DDA877");
            var bundleContentMock = new Mock <IBundleContent>();
            var bundle            = new Bundle(
                new Uuid(Guid.NewGuid()),
                new LegacyActorId(new GlobalLocationNumber("fake_value")),
                DomainOrigin.TimeSeries,
                new ContentType("fake_value"),
                Array.Empty <Uuid>(),
                bundleContentMock.Object,
                Enumerable.Empty <string>());

            var warehouseDomainServiceMock = new Mock <IMarketOperatorDataDomainService>();

            warehouseDomainServiceMock.Setup(x => x.CanAcknowledgeAsync(
                                                 It.Is <LegacyActorId>(r => string.Equals(r.Value, request.MarketOperator, StringComparison.OrdinalIgnoreCase)),
                                                 It.Is <Uuid>(id => string.Equals(id.ToString(), request.BundleId, StringComparison.OrdinalIgnoreCase))))
            .ReturnsAsync((true, bundle));

            var dequeueNotificationSenderMock = new Mock <IDequeueNotificationSender>();

            dequeueNotificationSenderMock.Setup(x => x.SendAsync(
                                                    bundle.ProcessId.ToString(),
                                                    It.IsAny <DequeueNotificationDto>(),
                                                    It.IsAny <MessageHub.Model.Model.DomainOrigin>())).Returns(Task.CompletedTask);

            var target = new DequeueHandler(
                warehouseDomainServiceMock.Object,
                dequeueNotificationSenderMock.Object,
                new Mock <ILogger>().Object,
                new Mock <ICorrelationContext>().Object);

            // Act
            var response = await target.Handle(request, CancellationToken.None).ConfigureAwait(false);

            // Assert
            Assert.NotNull(response);
            Assert.True(response.IsDequeued);
            dequeueNotificationSenderMock.Verify(
                x => x.SendAsync(
                    bundle.ProcessId.ToString(),
                    It.IsAny <DequeueNotificationDto>(),
                    It.IsAny <MessageHub.Model.Model.DomainOrigin>()),
                Times.Once);
        }