public async Task Cannot_delete_ManagementStaff_when_it_not_existing() { const string MANAGEMENT_STAFF_ID = "EMP100"; using (var context = new ProcurementDbContext(ContextOptions)) { ManagementStaffsController managementStaffsController = new ManagementStaffsController(context); var result = await managementStaffsController.DeleteManagementStaff(MANAGEMENT_STAFF_ID); var viewResult = Assert.IsType <ActionResult <ManagementStaff> >(result); Assert.IsNotType <ManagementStaff>(viewResult.Value); var response = Assert.IsType <NotFoundResult>(viewResult.Result); Assert.Equal(404, response.StatusCode); } }
public async Task Can_delete_ManagementStaff_by_Id() { const string MANAGEMENT_STAFF_ID = "EMP11"; using (var context = new ProcurementDbContext(ContextOptions)) { ManagementStaffsController managementStaffsController = new ManagementStaffsController(context); var result = await managementStaffsController.DeleteManagementStaff(MANAGEMENT_STAFF_ID); var viewResult = Assert.IsType <ActionResult <ManagementStaff> >(result); var model = Assert.IsType <ManagementStaff>(viewResult.Value); Assert.Equal(MANAGEMENT_STAFF_ID, model.StaffId); } }