public void DeleteStockHandler()
        {
            //init
            var dalMock = new Mock <IVendingDataAccessLayer>();

            //act
            var delete = new DeleteStock("f1");

            new DeleteStockHandler(dalMock.Object).Handle(delete);

            //assert
            dalMock.Verify(layer =>
                           layer.Delete(It.Is <string>(item => item == delete.Flavour)), Times.Never);
        }
        public void DeleteStockHandlerWithData()
        {
            //init
            var dalMock = new Mock <IVendingDataAccessLayer>();

            dalMock.Setup(layer => layer.GetAll()).Returns(() => new List <CanItem> {
                new CanItem("f1", 1, 1)
            });
            var delete = new DeleteStock("f1");

            //act
            new DeleteStockHandler(dalMock.Object).Handle(delete);

            //assert
            dalMock.Verify(layer =>
                           layer.Delete(It.Is <string>(item => item == delete.Flavour)), Times.Once);
        }
Esempio n. 3
0
 public async Task <IActionResult> DeleteStock(
     int id,
     [FromServices] DeleteStock deleteStock) => Ok(await deleteStock.Do(id));
Esempio n. 4
0
 public async Task <IActionResult> DeleteStocks(
     Guid id,
     [FromServices] DeleteStock deleteStock) =>
 Ok((await deleteStock.DoAsync(id)));
Esempio n. 5
0
 public async Task <IActionResult> DeleteStock(int id, [FromServices] DeleteStock deleteStock)
 {
     return(Ok(await deleteStock.ExecAsync(id)));
 }
 public Task <int> DeleteStock(int id, [FromServices] DeleteStock deleteStock) =>
 deleteStock.Do(id);