protected override clsBook tempBook()
        {
            clsBook lcBook = base.tempBook();

            lcBook.hardback = chkHardback.Checked;
            return(lcBook);
        }
Пример #2
0
        public void ValidMethodOK()
        {
            clsBook ABook    = new clsBook();
            string  ErrorMsg = "";

            ErrorMsg = ABook.Valid(Title, DatePublished, Stock, Price, AvailableOnline);
        }
Пример #3
0
        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);
        }
Пример #4
0
        public void InstanceOK()
        {
            //create book object
            clsBook ABook = new clsBook();

            //assert class exists
            Assert.IsNotNull(ABook);
        }
Пример #5
0
        public void BookIDMaxMinusOne()
        {
            clsBook ABook    = new clsBook();
            string  ErrorMsg = "";
            int     BookID   = 2147483646;

            ErrorMsg = ABook.Valid(Title, DatePublished, Stock, Price, AvailableOnline);
            Assert.AreEqual(ErrorMsg, "");
        }
Пример #6
0
        public void BookIDMid()
        {
            clsBook ABook    = new clsBook();
            string  ErrorMsg = "";
            int     BookID   = 1073741823;

            ErrorMsg = ABook.Valid(Title, DatePublished, Stock, Price, AvailableOnline);
            Assert.AreEqual(ErrorMsg, "");
        }
Пример #7
0
        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());
        }
Пример #9
0
        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);
        }
Пример #10
0
        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);
        }
Пример #11
0
        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);
        }
Пример #12
0
        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);
        }
Пример #13
0
        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);
        }
Пример #14
0
        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);
        }
Пример #15
0
        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);
        }
Пример #16
0
        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));
        }
Пример #18
0
        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);
        }
Пример #19
0
        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);
        }
Пример #20
0
        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);
        }
Пример #21
0
        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);
        }
Пример #22
0
        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);
 }