protected override clsBook tempBook() { clsBook lcBook = base.tempBook(); lcBook.hardback = chkHardback.Checked; return(lcBook); }
public void ValidMethodOK() { clsBook ABook = new clsBook(); string ErrorMsg = ""; ErrorMsg = ABook.Valid(Title, DatePublished, Stock, Price, AvailableOnline); }
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 InstanceOK() { //create book object clsBook ABook = new clsBook(); //assert class exists Assert.IsNotNull(ABook); }
public void BookIDMaxMinusOne() { clsBook ABook = new clsBook(); string ErrorMsg = ""; int BookID = 2147483646; ErrorMsg = ABook.Valid(Title, DatePublished, Stock, Price, AvailableOnline); Assert.AreEqual(ErrorMsg, ""); }
public void BookIDMid() { clsBook ABook = new clsBook(); string ErrorMsg = ""; int BookID = 1073741823; ErrorMsg = ABook.Valid(Title, DatePublished, Stock, Price, AvailableOnline); Assert.AreEqual(ErrorMsg, ""); }
public void FindMethodOK() { clsBook ABook = new clsBook(); bool found = false; int BookID = 1; found = ABook.Find(BookID); Assert.IsTrue(found); }
public ActionResult Create(clsBook objBook) { if (ModelState.IsValid) { clsBook.AddList(objBook); return(RedirectToAction("Index")); } return(View()); }
public void AvailableOnlineOK() { //create book object clsBook book1 = new clsBook(); //test data to assign to property bool TestData = true; //assign test data to property book1.AvailableOnline = TestData; //assert the test data and property hold the same value Assert.AreEqual(book1.AvailableOnline, TestData); }
public void PriceOK() { //create book object clsBook book1 = new clsBook(); //test data to assign to property float TestData = 9.99F; //assign test data to property book1.Price = TestData; //assert the test data and property hold the same value Assert.AreEqual(book1.Price, TestData); }
public void DatePublishedOK() { //create book object clsBook book1 = new clsBook(); //test data to assign to property DateTime TestData = DateTime.Now.Date; //assign test data to property book1.DatePublished = TestData; //assert the test data and property hold the same value Assert.AreEqual(book1.DatePublished, TestData); }
public void StockOK() { //create book object clsBook ABook = new clsBook(); //test data to assign to property int TestData = 5; //assign test data to property ABook.Stock = TestData; //assert the test data and property hold the same value Assert.AreEqual(ABook.Stock, TestData); }
public void BookIDOK() { //create book object clsBook book1 = new clsBook(); //test data to assign to property Int32 TestData = 5; //assign test data to property book1.BookID = TestData; //assert the test data and property hold the same value Assert.AreEqual(book1.BookID, TestData); }
public void TitleOK() { //create book object clsBook book1 = new clsBook(); //test data to assign to property string TestData = "Example Book Title"; //assign test data to property book1.Title = TestData; //assert the test data and property hold the same value Assert.AreEqual(book1.Title, TestData); }
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 TestAvailableOnlineFound() { clsBook ABook = new clsBook(); bool found = false; bool ok = true; int BookID = 1; found = ABook.Find(BookID); if (ABook.AvailableOnline != true) { ok = false; } Assert.IsTrue(ok); }
// GET: Book public ActionResult Index() { clsBook objBook = new clsBook(); //{ // bookId = 1, // bookName = "Some Book", // Author = "Some Author" //}; //if (!(clsBookTable.lstBook.Any())) // clsBook.AddList(objBook); var model = objBook.GetAllBooks(); return(View("Index2", model)); }
public void TestPriceFound() { clsBook ABook = new clsBook(); bool found = false; bool ok = true; int BookID = 1; found = ABook.Find(BookID); if (ABook.Price != 9.99F) { ok = false; } Assert.IsTrue(ok); }
public void TestStockFound() { clsBook ABook = new clsBook(); bool found = false; bool ok = true; int BookID = 1; found = ABook.Find(BookID); if (ABook.Stock != 3) { ok = false; } Assert.IsTrue(ok); }
public void TestDateAddedFound() { clsBook ABook = new clsBook(); bool found = false; bool ok = true; int BookID = 1; found = ABook.Find(BookID); if (ABook.DatePublished != Convert.ToDateTime("12/12/2012")) { ok = false; } Assert.IsTrue(ok); }
public void TestTitleFound() { clsBook ABook = new clsBook(); bool found = false; bool ok = true; int BookID = 1; found = ABook.Find(BookID); if (ABook.Title != "Test") { ok = false; } Assert.IsTrue(ok); }
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 ActionResult Edit(clsBook objBook) { if (ModelState.IsValid) { var bookToRemove = clsBook.GetBookById(objBook.bookId); if (clsBook.RemoveBookById(bookToRemove)) { clsBook.AddList(objBook); } return(RedirectToAction("Index")); } else { return(View("Index")); } }
public static void Run(clsBook prBook) { Instance.SetDetails(prBook); }