public void LoanIntegration_Delete_ShouldBeOk() { _loan.Id = 1; _service.Delete(_loan); _expectedLoan = _service.Get(_loan); _expectedLoan.Should().BeNull(); }
public void LoanService_Delete_ShouldBeOk() { _book.Object.Id = 1; _book.Object.Availability = true; _loan = ObjectMother.GetLoan(_book.Object); _repository.Setup(rp => rp.Delete(_loan.Id)); _repository.Setup(rp => rp.Get(_loan.Id)); _service.Delete(_loan); _expectedLoan = _service.Get(_loan); _expectedLoan.Should().BeNull(); _repository.Verify(rp => rp.Delete(_loan.Id)); }
public async Task <IActionResult> DeleteConfirmed(int?id) { var bookLoan = context.GetBookLoanById(id.GetValueOrDefault()); context.Delete(bookLoan); return(RedirectToAction(nameof(Index))); }
public void LoanSqlRepository_Delete_ShouldBeOk() { //Cenário int idSearch = 1; Loan loan = _service.Get(idSearch); loan.Book.Disponibility = true; //Executa _service.Delete(loan); //Saída Loan result = _service.Get(idSearch); result.Should().BeNull(); }
public IActionResult Delete(int id) { System.Text.StringBuilder sb = new System.Text.StringBuilder(); try { Loan ObjLoan = _loanService.Get(id); _loanService.Delete(ObjLoan); sb.Append("Sumitted"); return(Content(sb.ToString())); } catch (Exception ex) { sb.Append("Error :" + ex.Message); } return(Content(sb.ToString())); }
private void BTNExcluir_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(TBXCodigo.Text)) { MessageBox.Show("Selecione uma locação para remover"); } else { try { LoanService = new LoanService(); var loanCode = Convert.ToInt32(TBXCodigo.Text); LoanService.Delete(loanCode); }catch (Exception ex) { MessageBox.Show("Não pode ser excluída esta locação, pois ela está relacionado com outros dados"); Console.WriteLine(ex.Message); } } }
public async Task <Loan> DeleteLoan(Loan loan) { await _loanService.Delete(loan); return(loan); }
public IHttpActionResult DelteLoan(int id) { _loanService.Delete(id); return(Ok()); }
public IActionResult Delete(string id) { _loanService.Delete(id); return(RedirectToAction("Index")); }
public IActionResult DeleteConfirmed(int id) { _loanService.Delete(id); return(RedirectToAction(nameof(Index))); }