public void EndorsementRepository_GetByBillIds()
        {
            EndorsementRepository sut = new EndorsementRepository();

            IReadOnlyList <IEnumerable <Endorsement> > result = sut.GetByBillIds(new int[] { 1, 3 });

            Assert.Multiple(() =>
            {
                Assert.AreEqual(4, result.First().Count());
                Assert.AreEqual(9, result.Last().Count());
            });
        }
        public List <EndorsmentListDto> GetByBillOfExhange(int billOfExhangeId)
        {
            IEnumerable <Endorsement> list = EndorsementRepository.GetByBillIds(new List <int> {
                billOfExhangeId
            }).FirstOrDefault()?.ToList() ?? new List <Endorsement>();
            BillOfExchange billOfExchange = BillOfExchangeRepository.GetByIds(new List <int> {
                billOfExhangeId
            }).First();

            var partyNamesDictionary = PartyRepository.GetByIds(list.Select(l => l.NewBeneficiaryId).Distinct().ToList()).ToDictionary(p => p.Id, p => p.Name);

            EndorsementCheckResult result = EndorsementChecker.CheckList(billOfExchange, list);

            if (!result.IsCorrect)
            {
                throw new Exception(result.Message);
            }
            return(list.Select(e => new EndorsmentListDto(e.Id, e.NewBeneficiaryId, partyNamesDictionary[e.NewBeneficiaryId])).ToList());
        }