Esempio n. 1
0
        public void SetUp()
        {
            List <Book> books = new List <Book>()
            {
                new Book(0, "Peppy long stocking", "Сhildren's literature", new DateTime(2020, 10, 14), 300),
                new Book(1, "War and Peace", "Novel", new DateTime(2020, 10, 10), 500)
            };

            _bookSystem = new BookShopSystem.BookShop(books, 1000);
        }
Esempio n. 2
0
        public void SetUp()
        {
            List <Book> books = new List <Book>()
            {
                new Book(22, "Hobbit", "Fiction", new DateTime(2020, 8, 14), 200),
                new Book(23, "Around the world", "Adventures", new DateTime(2020, 8, 10), 200),
                new Book(24, "The World", "Encyclopedia", new DateTime(2020, 8, 10), 200),
            };

            _books      = books;
            _bookSystem = new BookShopSystem.BookShop(books, 1000);
        }
Esempio n. 3
0
        public void BadSupplyEnoughBooksInShop()
        {
            List <Book> books = new List <Book>()
            {
                new Book(5, "Book1", "Stories", DateTime.Now, 100),
                new Book(6, "Book2", "Stories", DateTime.Now, 200),
                new Book(7, "Book3", "Stories", DateTime.Now, 100),
                new Book(8, "Book4", "Stories", DateTime.Now, 200),
                new Book(9, "Book5", "Stories", DateTime.Now, 100),
                new Book(10, "Book5", "Stories", DateTime.Now, 100)
            };

            BookShopSystem.BookShop bsSystem = new BookShopSystem.BookShop(books, 1000);
            Book book = new Book(11, "Book7", "Stories", DateTime.Now, 50);

            Assert.Throws <ApplicationException>(() => bsSystem.AcceptBooks(new List <Book> {
                book
            }));
        }
Esempio n. 4
0
        public void GoodSupplyOldBooksInShop()
        {
            DateTime oldDate = new DateTime(10, 10, 18);

            List <Book> books = new List <Book>()
            {
                new Book(12, "Book1", "Stories", oldDate, 100),
                new Book(13, "Book2", "Stories", oldDate, 200),
                new Book(14, "Book3", "Stories", oldDate, 100),
                new Book(15, "Book4", "Stories", oldDate, 200),
                new Book(16, "Book5", "Stories", oldDate, 100),
                new Book(17, "Book5", "Stories", oldDate, 100)
            };

            BookShopSystem.BookShop bsSystem = new BookShopSystem.BookShop(books, 1000);
            Book book = new Book(18, "Book7", "Stories", DateTime.Now, 50);

            Assert.DoesNotThrow(() => bsSystem.AcceptBooks(new List <Book> {
                book
            }));
        }