public void TestIfGetAllReturnsCorrectValues() { var genres = genreBusiness.GetAll(); Assert.AreEqual(3, genres.Count, "Doesn't return correct number of books!"); Assert.AreEqual("Genre 1", genres[0].Name, "Genre 1's Name isn't equal to Genre 1"); Assert.AreEqual("Genre 2", genres[1].Name, "Genre 2's Name isn't equal to Genre 2"); Assert.AreEqual("Genre 3", genres[2].Name, "Genre 3's Name isn't equal to Genre 3"); }
private void LoadComboBoxGenres() { List <Genre> genres = GenreBusiness.GetAll(); genres.Insert(0, new Genre()); comboBoxGenre.DataSource = genres; comboBoxGenre.DisplayMember = "Name"; comboBoxGenre.ValueMember = "Name"; }
private void ListAll() { Console.WriteLine(new string('-', 40)); Console.WriteLine(new string(' ', 16) + "Genres" + new string(' ', 16)); Console.WriteLine(new string('-', 40)); var genres = genreBusiness.GetAll(); foreach (var genre in genres) { Console.WriteLine("{0} || {1}", genre.Id, genre.Name); } }
private FormChoose(Type type) : this() { selectedType = type; if (type == typeof(RomLabel)) { List <RomLabel> labels = RomLabelBusiness.GetAll(); labels.Insert(0, new RomLabel()); comboBox.DataSource = labels; comboBox.DisplayMember = "Name"; comboBox.ValueMember = "Name"; labelChoose.Text = "Choose Label"; this.Text = "Choose Label"; buttonCancel.Visible = false; buttonClose.Text = "Cancel and close"; buttonAdd.Text = "Save and close"; } else if (type == typeof(Genre)) { List <Genre> genres = GenreBusiness.GetAll(); genres.Insert(0, new Genre()); comboBox.DataSource = genres; comboBox.DisplayMember = "Name"; comboBox.ValueMember = "Name"; labelChoose.Text = "Choose Genre"; this.Text = "Choose Genre"; buttonCancel.Visible = false; buttonClose.Text = "Cancel and close"; buttonAdd.Text = "Save and close"; } else if (type == typeof(string)) { var status = Values.Status.ToArray().ToList(); status.Insert(0, ""); comboBox.DataSource = status; labelChoose.Text = "Choose Status"; this.Text = "Choose Status"; buttonCancel.Visible = false; buttonClose.Text = "Cancel and close"; buttonAdd.Text = "Save and close"; } }
private void FormGenre_Load(object sender, EventArgs e) { buttonAdd.Click += buttonAdd_Click; buttonDelete.Click += buttonDelete_Click; buttonCancel.Click += buttonCancel_Click; updating = true; dataGridView.ClearSelection(); dataGridView.Rows.Clear(); List <Genre> genres = GenreBusiness.GetAll(); foreach (Genre genre in genres) { AddToGrid(genre, -1); } updating = false; Clean(); }
private void FillGenreFilter(string genre = "") { updating = true; List <Genre> genres = GenreBusiness.GetAll(); genres.Insert(0, new Genre()); genres.Insert(1, new Genre() { Name = "<none>" }); comboBoxGenre.DataSource = genres.Select(x => x.Name).ToList(); if (genre == "") { comboBoxGenre.SelectedIndex = 0; } else { comboBoxGenre.Text = genre; } updating = false; }