public async Task Can_delete_GoodsReceipt_by_ReceiptId() { const int RECEIPT_ID = 1; using (var context = new ProcurementDbContext(ContextOptions)) { GoodsReceiptsController receiptsController = new GoodsReceiptsController(context); var result = await receiptsController.DeleteGoodsReceipt(RECEIPT_ID); var viewResult = Assert.IsType <ActionResult <GoodsReceipt> >(result); var goodsReceipt = Assert.IsType <GoodsReceipt>(viewResult.Value); Assert.Equal(RECEIPT_ID, goodsReceipt.ReceiptId); } }
public async Task Cannot_delete_GoodsReceipt_when_it_not_exist() { const int RECEIPT_ID = 11; using (var context = new ProcurementDbContext(ContextOptions)) { GoodsReceiptsController receiptsController = new GoodsReceiptsController(context); var result = await receiptsController.DeleteGoodsReceipt(RECEIPT_ID); var viewResult = Assert.IsType <ActionResult <GoodsReceipt> >(result); Assert.IsNotType <GoodsReceipt>(viewResult.Value); var response = Assert.IsType <NotFoundResult>(viewResult.Result); Assert.Equal(404, response.StatusCode); } }