public void Should_Success_Delete_Data() { var dbContext = _dbContext(GetCurrentMethod()); UnitReceiptNoteFacade facade = new UnitReceiptNoteFacade(_ServiceProvider.Object, dbContext); var dataUtil = _dataUtil(facade, dbContext).GetTestData(USERNAME).Result; var response = facade.Delete((int)dataUtil.Id, dataUtil.CreatedBy); Assert.NotEqual(response, 0); }
public async Task Should_Success_Delete_Data() { var dbContext = _dbContext(GetCurrentMethod()); UnitReceiptNoteFacade facade = new UnitReceiptNoteFacade(_ServiceProvider(GetCurrentMethod()).Object, dbContext); var dataUtil = await _dataUtil(facade, dbContext, GetCurrentMethod()).GetTestData(USERNAME); var response = await facade.Delete((int)dataUtil.Id, dataUtil.CreatedBy); Assert.NotEqual(0, response); }
public IActionResult Delete([FromRoute] int id) { identityService.Token = Request.Headers["Authorization"].First().Replace("Bearer ", ""); identityService.Username = User.Claims.Single(p => p.Type.Equals("username")).Value; try { _facade.Delete(id, identityService.Username); return(NoContent()); } catch (Exception) { return(StatusCode(General.INTERNAL_ERROR_STATUS_CODE)); } }