public async Task <ActionResult <bool> > Delete(string id) { var query = new DeleteBasketCommand(id); var result = await _mediator.Send(query); return(Ok(result)); }
public BasketController(CreateBasketCommand createBasketCommand, BasketQuery basketQuery, DeleteBasketCommand deleteBasketCommand, AddItemToBasketCommand addItemToBasketCommand, UpdateItemQuantityCommand updateItemQuantityCommand) { _createBasketCommand = createBasketCommand; _basketQuery = basketQuery; _deleteBasketCommand = deleteBasketCommand; _addItemToBasketCommand = addItemToBasketCommand; _updateItemQuantityCommand = updateItemQuantityCommand; }
public async Task Handle_BasketDeleted( [Frozen] Mock <IBasketRepository> mockBasketRepository, DeleteBasketCommandHandler sut, DeleteBasketCommand command ) { //Arrange //Act var result = await sut.Handle(command, CancellationToken.None); //Assert result.Should().Be(Unit.Value); mockBasketRepository.Verify(_ => _.DeleteBasketAsync( It.IsAny <string>() )); }
private void DeleteBasket() { DeleteBasketCommand command = new DeleteBasketCommand(_basketRepository); command.Do(new BasketId(_basketId, _consumerId)); }
public async Task <IActionResult> DeleteBasket([FromBody] DeleteBasketCommand request) { await _mediator.Send(request); return(Accepted()); }