public void GivenBorrowWhenAddScoreThenScoreIsAddedAndAverageIsCalculateOk()
        {
            int     score1   = 5;
            int     score2   = 1;
            int     average  = (score1 + score2) / 2;
            User    borrower = new User("Test");
            User    lender   = new User("Test1");
            Product product  = new Product(lender, "Test", "Test", new ProductType(), new Term(DateTime.Now.AddDays(-6), DateTime.Now));
            Borrow  borrow   = new Borrow(borrower, product, new Term(DateTime.Now.AddDays(-2), DateTime.Now.AddDays(-1)));

            Assert.False(borrow.Scores.Any());
            borrow.AddScore(new Score(score1), lender);
            borrow.AddScore(new Score(score2), borrower);
            Assert.True(borrow.Scores.Any());
            borrow.AverageScore().Should().Be(average);
        }
        public async Task SetScore(int borrowId, ClaimsPrincipal user, int score)
        {
            if (user == null)
            {
                throw new ArgumentNullException(nameof(user));
            }

            Borrow borrowDomain = await GetBorrowAsync(borrowId);

            User userDomain = await this._userManager.FindUserDomain(user);

            borrowDomain.AddScore(new Score(score), userDomain);
            await this._borrowRepository.Save(borrowDomain);
        }