public void UpdateMethodOK() { clsBookCollection AllBooks = new clsBookCollection(); clsBook TestItem = new clsBook(); int PrimaryKey = 0; //TestItem.BookID = 1; TestItem.Title = "Oxford English Dictionary"; TestItem.DatePublished = Convert.ToDateTime("1/2/1884"); TestItem.Stock = 50; TestItem.Price = 4.99F; TestItem.AvailableOnline = false; AllBooks.ThisBook = TestItem; PrimaryKey = AllBooks.Add(); TestItem.BookID = PrimaryKey; //TestItem.BookID = 1; TestItem.Title = "Oxford English Dictionary"; TestItem.DatePublished = Convert.ToDateTime("1/2/1884"); TestItem.Stock = 100; TestItem.Price = 4.99F; TestItem.AvailableOnline = false; AllBooks.ThisBook = TestItem; AllBooks.Update(); AllBooks.ThisBook.Find(PrimaryKey); Assert.AreEqual(AllBooks.ThisBook, TestItem); }
public void FilterByTitleNoneFound() { clsBookCollection FilteredBooks = new clsBookCollection(); FilteredBooks.FilterByTitle("nonexistent book title here"); Assert.AreEqual(0, FilteredBooks.Count); }
public void CountPropertyOK() { clsBookCollection AllBooks = new clsBookCollection(); int someCount = 2; AllBooks.Count = someCount; Assert.AreEqual(AllBooks.Count, someCount); }
public void FilterByTitleMethodOK() { clsBookCollection AllBooks = new clsBookCollection(); clsBookCollection FilteredBooks = new clsBookCollection(); FilteredBooks.FilterByTitle(""); Assert.AreEqual(AllBooks.Count, FilteredBooks.Count); }
protected void btnConfirm_Click(object sender, EventArgs e) { clsBookCollection ABook = new clsBookCollection(); ABook.ThisBook.Find(BookID); ABook.Delete(); Response.Redirect("BookList.aspx"); }
void DisplayBooks() { clsBookCollection Books = new clsBookCollection(); lstBookList.DataSource = Books.BookList; lstBookList.DataValueField = "BookID"; lstBookList.DataTextField = "Title"; lstBookList.DataBind(); }
protected void btnApply_Click(object sender, EventArgs e) { clsBookCollection Books = new clsBookCollection(); Books.FilterByTitle(txtFilter.Text); lstBookList.DataSource = Books.BookList; lstBookList.DataValueField = "BookID"; lstBookList.DataTextField = "Title"; lstBookList.DataBind(); }
public void ThisBookPropertyOK() { clsBookCollection AllBooks = new clsBookCollection(); clsBook TestItem = new clsBook(); TestItem.BookID = 1; TestItem.Title = "Oxford English Dictionary"; TestItem.DatePublished = Convert.ToDateTime("1/2/1884"); TestItem.Stock = 50; TestItem.Price = 4.99F; TestItem.AvailableOnline = false; AllBooks.ThisBook = TestItem; Assert.AreEqual(AllBooks.ThisBook, TestItem); }
public void ListAndCountOK() { clsBookCollection AllBooks = new clsBookCollection(); List <clsBook> TestList = new List <clsBook>(); clsBook TestItem = new clsBook(); TestItem.BookID = 1; TestItem.Title = "Oxford English Dictionary"; TestItem.DatePublished = Convert.ToDateTime("1/2/1884"); TestItem.Stock = 50; TestItem.Price = 4.99F; TestItem.AvailableOnline = false; TestList.Add(TestItem); AllBooks.BookList = TestList; Assert.AreEqual(AllBooks.Count, TestList.Count); }
public void FilterByTitleTestDataFound() { clsBookCollection FilteredBooks = new clsBookCollection(); bool OK = true; FilteredBooks.FilterByTitle("nonexistent book title here"); if (FilteredBooks.Count == 1) { if (FilteredBooks.BookList[0].BookID != 1) { OK = false; } } else { OK = false; } Assert.IsTrue(OK); }
public void InstanceOK() { clsBookCollection AllBooks = new clsBookCollection(); Assert.IsNotNull(AllBooks); }