public async Task Cannot_delete_AccountingStaff_when_it_not_existing() { const string ACCOUNTING_STAFF_ID = "EMP100"; using (var context = new ProcurementDbContext(ContextOptions)) { AccountingStaffsController accountingStaffsController = new AccountingStaffsController(context); var result = await accountingStaffsController.DeleteAccountingStaff(ACCOUNTING_STAFF_ID); var viewResult = Assert.IsType <ActionResult <AccountingStaff> >(result); Assert.IsNotType <AccountingStaff>(viewResult.Value); var response = Assert.IsType <NotFoundResult>(viewResult.Result); Assert.Equal(404, response.StatusCode); } }
public async Task Can_delete_AccountingStaff_by_Id() { const string ACCOUNTING_STAFF_ID = "EMP21"; using (var context = new ProcurementDbContext(ContextOptions)) { AccountingStaffsController accountingStaffsController = new AccountingStaffsController(context); var result = await accountingStaffsController.DeleteAccountingStaff(ACCOUNTING_STAFF_ID); var viewResult = Assert.IsType <ActionResult <AccountingStaff> >(result); var model = Assert.IsType <AccountingStaff>(viewResult.Value); Assert.Equal(ACCOUNTING_STAFF_ID, model.StaffId); } }