public async Task Handle_Uses_SaveAllAsync_From_IUnitOfWork()
        {
            // Arrange
            Arrange();

            var sut = new CancelDeliveryCommandHandler(
                _deliveryRepository.Object,
                _existsDelivery.Object,
                _userContext.Object,
                _unitOfWork.Object);
            // Act
            await sut.Handle(NewCancelDeliveryCommand(), new CancellationToken());

            // Assert
            _unitOfWork.Verify(u => u.SaveAllAsync(), Times.Once);
        }
        public async Task Handle_Uses_EnforceRule_From_IExistsDeliverySpecification()
        {
            // Arrange
            Arrange();

            var sut = new CancelDeliveryCommandHandler(
                _deliveryRepository.Object,
                _existsDelivery.Object,
                _userContext.Object,
                _unitOfWork.Object);
            // Act
            await sut.Handle(NewCancelDeliveryCommand(), new CancellationToken());

            // Assert
            _existsDelivery.Verify(s => s.EnforceRule(It.IsAny <Delivery>(), It.IsAny <string>()), Times.Once);
        }
        public async Task Handle_Uses_Update_From_IDeliveryRepository_With_Delivery_State_Is_Cancelled()
        {
            // Arrange
            Arrange();

            var sut = new CancelDeliveryCommandHandler(
                _deliveryRepository.Object,
                _existsDelivery.Object,
                _userContext.Object,
                _unitOfWork.Object);
            // Act
            await sut.Handle(NewCancelDeliveryCommand(), new CancellationToken());

            // Assert
            _deliveryRepository.Verify(r => r.Update(It.Is <Delivery>(d => d.State == DeliveryState.Cancelled)), Times.Once);
        }
        public async Task Handle_Uses_GetAsync_From_IDeliveryRepository_To_Get_The_Delivery()
        {
            // Arrange
            Arrange();

            var sut = new CancelDeliveryCommandHandler(
                _deliveryRepository.Object,
                _existsDelivery.Object,
                _userContext.Object,
                _unitOfWork.Object);
            // Act
            await sut.Handle(NewCancelDeliveryCommand(), new CancellationToken());

            // Assert
            _deliveryRepository.Verify(r => r.GetAsync(It.IsAny <Expression <Func <Delivery, bool> > >()), Times.Once);
        }