public async Task GetBookById_InvalidId_RaiseArgumentException(int id) { // Arrange var bookQueryService = new BookQueryService(_mockedBooksDbContext, _mockedMapper); // Act and Assert await Assert.ThrowsExceptionAsync <ArgumentException>(() => bookQueryService.GetBookById(id)); }
public async Task GetBookById_InvalidId_ReturnNull(int id) { // Arrange var bookQueryService = new BookQueryService(_mockedBooksDbContext, _mockedMapper); // Act var book = await bookQueryService.GetBookById(id); // Assert Assert.IsNull(book); }
public async Task GetBookById_ValidId_ReturnNotNull() { // Arrange var bookQueryService = new BookQueryService(_mockedBooksDbContext, _mockedMapper); // Act var books = await bookQueryService.GetBookById(ValidId); // Assert Assert.IsNotNull(books); }
public ActionResult Detail(Guid id) { Book book = queryService.GetBookById(id); return(View(book)); }