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)); }
public void AddBook_ShouldAddBook() { // Arrange // Act var result = controller.AddBook(new BookModel() { Name = "Test Book Name", Author = "Test Book Author" }); var response = result as OkResult; // Assert Assert.IsNotNull(response); }
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)); }