public void GetAllLoans() { var loans = _controller.GetAll(); _repo.Verify(x => x.GetAll(), Times.Once); Assert.Equal(1, loans.Count); }
private void updateAll() { try { this.Controls.Clear(); InitializeComponent(); dgvPartner.AutoGenerateColumns = false; dgvPartner.DataSource = null; foreach (Partner auxPartner in partnerController.GetAll()) { dgvPartner.Rows.Add(auxPartner.LastName, auxPartner.FirstName, auxPartner.DNI, auxPartner.Address, auxPartner.Phone); } dgvBook.AutoGenerateColumns = false; dgvBook.DataSource = null; foreach (Book auxBook in bookController.GetAll()) { dgvBook.Rows.Add(auxBook.ISBN, auxBook.Title, auxBook.Author.Name, auxBook.Editorial.Name, auxBook.Year, auxBook.Edition, auxBook.EditionYear, auxBook.Deterioration); } dgvLoan.AutoGenerateColumns = false; dgvLoan.DataSource = null; foreach (Loan auxLoan in loanController.GetAll()) { dgvLoan.Rows.Add(auxLoan.LoanID, (auxLoan.Partner.LastName + " " + auxLoan.Partner.FirstName), auxLoan.Book.Title, auxLoan.LoanDate, auxLoan.EstimatedDate, auxLoan.DevolutionDate); } dgvAuthor.AutoGenerateColumns = false; dgvAuthor.DataSource = null; foreach (Author auxAuthor in authorController.GetAll()) { dgvAuthor.Rows.Add(auxAuthor.AuthorID, auxAuthor.Name); } dgvEditorial.AutoGenerateColumns = false; dgvEditorial.DataSource = null; foreach (Editorial auxEditorial in editorialController.GetAll()) { dgvEditorial.Rows.Add(auxEditorial.EditorialID, auxEditorial.Name); } cmbBookAuthor.DataSource = null; cmbBookAuthor.DataSource = authorController.GetAll(); cmbBookEditorial.DataSource = null; cmbBookEditorial.DataSource = editorialController.GetAll(); cmbBookEditorial.ValueMember = "editorialID"; cmbBookEditorial.DisplayMember = "name"; cmbLoan.DataSource = loanController.FilteredList(); cmbLoan.ValueMember = "loanID"; cmbLoan.DisplayMember = "loanFull"; cmbLoanPartner.DataSource = partnerController.GetAll(); cmbLoanPartner.ValueMember = "partnerID"; cmbLoanPartner.DisplayMember = "DNI"; cmbLoanBook.DataSource = bookController.GetNoLoaned(loanController.GetAll()); cmbLoanBook.ValueMember = "bookID"; cmbLoanBook.DisplayMember = "title"; foreach (DataGridViewRow row in dgvLoan.Rows) { if (default(DateTime) == (DateTime)row.Cells[5].Value) { row.DefaultCellStyle.BackColor = Color.LightGreen; } else { row.DefaultCellStyle.BackColor = Color.LightPink; } } } catch (Exception ex) { error = ex.Message; MessageBox.Show(error); } }