private void init()
        {
            libraryController = new LibraryController();

            UserDto userDto0 = new UserDto("login0", "name0", "firstname0", Role.student, null);

            libraryController.AddUser(userDto0, "password0");

            UserDto userDto1 = new UserDto("login1", "name1", "firstname1", Role.student, null);

            libraryController.AddUser(userDto1, "password1");

            UserDto userDto2 = new UserDto("login2", "name2", "firstname2", Role.librarian, null);

            libraryController.AddUser(userDto1, "password2");

            UserDto userDto3 = new UserDto("login3", "name3", "firstname3", Role.librarian, null);

            libraryController.AddUser(userDto3, "password3");

            Book bookBasic = new BookBasic("AS0", "TitreAS0");

            Assert.IsTrue(libraryController.AddBook(bookBasic));

            Book bookBasic1 = new BookBasic("AS1", "TitreAS1");

            Assert.IsTrue(libraryController.AddBook(bookBasic1));
        }
Beispiel #2
0
        public void Should_add_complet_basic_book()
        {
            Book bookBasic = new BookBasic("1", "Titre du livre");

            bookDataInMemory.Add(bookBasic);
            Assert.AreEqual(1, bookDataInMemory.Search("Titre du livre").Count());
        }
Beispiel #3
0
        public void Should_not_add_incomplet_basic_book()
        {
            ((BookDataInMemory)bookDataInMemory).Clear();
            Book bookBasic2 = new BookBasic("2", "");

            bookDataInMemory.Add(bookBasic2);
            Assert.AreEqual(0, bookDataInMemory.Search("").Count());
        }
Beispiel #4
0
        private void InitData()
        {
            ((BookDataInMemory)bookDataInMemory).Clear();
            BookBasic book0 = new BookBasic("0", "Livre 0");

            bookDataInMemory.Add(book0);
            BookWithDvd book1 = new BookWithDvd("1", "Livre 1", 1);

            bookDataInMemory.Add(book1);
        }
        public void Should_add_book()
        {
            init();
            Book bookBasic = new BookBasic("0", "Titre0");

            Assert.IsTrue(libraryController.AddBook(bookBasic));

            Book bookWithDvd = new BookWithDvd("1", "Titre1", 3);

            Assert.IsTrue(libraryController.AddBook(bookWithDvd));
        }
        public BookDataInMemory()
        {
            Books = new List <Book>();
            Book book1 = new BookBasic(1, "Harry Potter 1");
            Book book2 = new BookWithDvd(2, "TOIC Preparation", 3);
            Book book3 = new BookBasic(3, "Harry Potter 2");

            Books.Add(book1);
            Books.Add(book2);
            Books.Add(book3);
        }
        public void Should_not_add_book()
        {
            init();
            //missing id
            Book bookBasic0 = new BookBasic(null, "Titre0");

            Assert.IsFalse(libraryController.AddBook(bookBasic0));
            //empty id
            Book bookBasic1 = new BookBasic("", "Titre1");

            Assert.IsFalse(libraryController.AddBook(bookBasic1));
            //missing titre
            Book bookBasic2 = new BookBasic("2", null);

            Assert.IsFalse(libraryController.AddBook(bookBasic2));
            //empty titre
            Book bookBasic3 = new BookBasic("3", "");

            Assert.IsFalse(libraryController.AddBook(bookBasic3));
        }
        private void initialUser(LibraryController controller)
        {
            /* Création d'un utilisateur initial */
            UserDto userDto = new UserDto("admin", "KANE", "Harry", Role.librarian, null);

            controller.AddUser(userDto, "admin");

            BookBasic book = new BookBasic("FR1", "Chartreuse");

            controller.AddBook(book);

            BookBasic book1 = new BookBasic("FR2", "Code civil 2019 annoté. Édition limitée");

            controller.AddBook(book1);

            BookBasic book2 = new BookBasic("OI1", "Shakespeare, Le Songe d’une nuit d’été");

            controller.AddBook(book2);

            BookBasic book3 = new BookBasic("PO1", "L'Intelligence des plantes");

            controller.AddBook(book3);

            BookBasic book4 = new BookBasic("FU1", "Passage des Ombres");

            controller.AddBook(book4);

            BookBasic book5 = new BookBasic("TY8", "Les Lois naturelles de l'enfant");

            controller.AddBook(book5);

            BookWithDvd book6 = new BookWithDvd("TR8", "Le capitalisme expliqué à ma petite-fille", 1);

            controller.AddBook(book6);

            BookWithDvd book7 = new BookWithDvd("PO1", "L'île des chasseurs d'oiseaux", 2);

            controller.AddBook(book7);
        }