Example #1
0
        public void RemoveBookTest()
        {
            var databaseSource      = DataSourceServiceFactory.GetDatabaseConnection();
            var businessLogic       = new BookBusinessLogic(databaseSource);
            int expectedBooksAmount = 4;

            businessLogic.RemoveBook(businessLogic.GetBookById(5));
            var actualBooksAmount = businessLogic.GetAllBooks().Count;

            Assert.AreEqual(expectedBooksAmount, actualBooksAmount, 0, "Book was not removed!");
        }
Example #2
0
        public void UpdateBookTest()
        {
            var    databaseSource   = DataSourceServiceFactory.GetDatabaseConnection();
            var    businessLogic    = new BookBusinessLogic(databaseSource);
            string expectedBookName = "UpdateTest";

            var book = businessLogic.GetAllBooks().LastOrDefault();

            book.Name = "UpdateTest";
            businessLogic.UpdateBook(book);
            var actualBookTitle = businessLogic.GetAllBooks().LastOrDefault().Name;

            Assert.AreSame(expectedBookName, actualBookTitle, "Books' title has not been changed");
        }
Example #3
0
        public void AddBookTest()
        {
            var databaseSource      = DataSourceServiceFactory.GetDatabaseConnection();
            var businessLogic       = new BookBusinessLogic(databaseSource);
            int expectedBooksAmount = 6;

            businessLogic.AddBook(new BusinessBook()
            {
                Id = 6
            });
            var actualBooksAmount = businessLogic.GetAllBooks().Count;

            Assert.AreEqual(expectedBooksAmount, actualBooksAmount, 0, "Book has not been added");
        }