public async Task Handle_Uses_SaveAllAsync_From_IUnitOfWork() { // Arrange Arrange(); var sut = new DeleteDeliveryCommandHandler( _deliveryRepository.Object, _existsDelivery.Object, _userContext.Object, _unitOfWork.Object); // Act await sut.Handle(NewDeleteDeliveryCommand(), new CancellationToken()); // Assert _unitOfWork.Verify(u => u.SaveAllAsync(), Times.Once); }
public async Task Handle_Uses_EnforceRule_From_IExistsDeliverySpecification() { // Arrange Arrange(); var sut = new DeleteDeliveryCommandHandler( _deliveryRepository.Object, _existsDelivery.Object, _userContext.Object, _unitOfWork.Object); // Act await sut.Handle(NewDeleteDeliveryCommand(), 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_Deleteled() { // Arrange Arrange(); var sut = new DeleteDeliveryCommandHandler( _deliveryRepository.Object, _existsDelivery.Object, _userContext.Object, _unitOfWork.Object); // Act await sut.Handle(NewDeleteDeliveryCommand(), new CancellationToken()); // Assert _deliveryRepository.Verify(r => r.Update(It.Is <Delivery>(d => d.IsDeleted)), Times.Once); }
public async Task Handle_Uses_GetAsync_From_IDeliveryRepository_To_Get_The_Delivery() { // Arrange Arrange(); var sut = new DeleteDeliveryCommandHandler( _deliveryRepository.Object, _existsDelivery.Object, _userContext.Object, _unitOfWork.Object); // Act await sut.Handle(NewDeleteDeliveryCommand(), new CancellationToken()); // Assert _deliveryRepository.Verify(r => r.GetAsync(It.IsAny <int>()), Times.Once); }