public void AddAssessment_GoodArgument_InOnDb_Exception()
        {
            var book = new Book
            {
                Id          = Guid.NewGuid().ToString(),
                Name        = "SomeBookName",
                Year        = 2020,
                BookUrl     = "SomeBookUrl",
                ImageIrl    = "SomeBookImageUrl",
                Description = "SomeBookDescription",
                Authors     = new List <AuthorBook>(),
                Genres      = new List <GenreBook>(),
                Likes       = new List <BookLike>(),
                Assessments = new List <BookAssessment>
                {
                    new BookAssessment
                    {
                        Id     = Guid.NewGuid().ToString(),
                        Book   = It.IsAny <Book>(),
                        BookId = It.IsAny <string>(),
                        User   = It.IsAny <User>(),
                        Count  = 7,
                        UserId = "123"
                    }
                },
                Comments  = new List <BookComment>(),
                Processes = new List <BookProcess>()
            };

            _mockBookRepository.Setup(w => w.GetById("123")).ReturnsAsync(book);
            using var bookService = new BookService(_mockBookRepository.Object, _mapper);
            Assert.ThrowsAsync <CustomException>(() => bookService.AddAssessment("123", "123", 7));
        }
        public void AddAssessment_GoodArgument_Success()
        {
            _mockBookRepository.Setup(w => w.GetById(It.IsAny <string>())).ReturnsAsync(_book);
            using var bookService = new BookService(_mockBookRepository.Object, _mapper);
            var addAssessment = bookService.AddAssessment(_book.Id, "123", 7);

            _mockBookRepository.Verify(w => w.AddAssessment(It.IsAny <Book>(), It.IsAny <string>(), 7), Times.Once);
        }
 public void AddAssessment_BadArgument_Assessment_Exception()
 {
     _mockBookRepository.Setup(w => w.GetById(It.IsAny <string>())).ReturnsAsync(() => null);
     using var bookService = new BookService(_mockBookRepository.Object, _mapper);
     Assert.ThrowsAsync <CustomException>(() => bookService.AddAssessment("123", "123", 11));
 }