예제 #1
0
        public EndorsementServiceTest()
        {
            _billOfExchangeRepository = new BillOfExchangeRepository();
            _endorsementRepository    = new EndorsementRepository();
            _billsOfExchangeService   = new BillsOfExchangeService(_billOfExchangeRepository, _endorsementRepository, new PartyService(new PartyRepository()));

            _endorsementService = new EndorsementService(new EndorsementRepository(), _billsOfExchangeService);
        }
예제 #2
0
        public void EndorsementRepository_GetByNewBeneficiaryIds()
        {
            EndorsementRepository sut = new EndorsementRepository();

            IReadOnlyList<IEnumerable<Endorsement>> result = sut.GetByNewBeneficiaryIds(new int[] { 15 });

            Assert.AreEqual(3, result.First().Count());
        }
예제 #3
0
        public void EndorsementRepository_Get()
        {
            EndorsementRepository sut = new EndorsementRepository();

            Endorsement[] result1 = sut.Get(10, 0).ToArray();
            Endorsement[] result2 = sut.Get(10, 5).ToArray();

            CollectionAssert.AreEqual(result1.Skip(5).Take(5), result2.Take(5));
        }
        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 void EndorsementRepository_GetByIds()
        {
            EndorsementRepository sut = new EndorsementRepository();

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

            Assert.Multiple(() =>
            {
                Assert.AreEqual(1, result.First().Id);
                Assert.AreEqual(3, result.Last().Id);
            });
        }
        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());
        }
예제 #7
0
 public UserManager(ClaimManager claimManager, EndorsementRepository endorsementRepository)
 {
     this.endorsementRepository = endorsementRepository;
     this.claimManager          = claimManager;
 }
예제 #8
0
 public EndorsementManager(ClaimRepository claimRepository, EndorsementRepository endorsementRepository, EmailManager emailManager)
 {
     this.claimRepository       = claimRepository;
     this.endorsementRepository = endorsementRepository;
     this.emailManager          = emailManager;
 }
예제 #9
0
 public EndorsementService(EndorsementRepository endorsementRepository, IEntityService entityService)
 {
     _endorsementRepository = endorsementRepository;
     _entityService         = entityService;
 }