Пример #1
0
 public CreditInput(CreditTypeEnum creditType, decimal value, int qtdInstallments, DateTime firstDueDate)
 {
     CreditType      = creditType;
     Value           = value;
     QtdInstallments = qtdInstallments;
     FirstDueDate    = firstDueDate;
 }
Пример #2
0
 public ICredit Create(CreditTypeEnum creditType, decimal value, int qtdInstallments, DateTime firstDueDate)
 {
     return(creditType switch
     {
         CreditTypeEnum.Direct => new DirectCredit(value, qtdInstallments, firstDueDate),
         CreditTypeEnum.Consigned => new ConsignedCredit(value, qtdInstallments, firstDueDate),
         CreditTypeEnum.Fiscal => new FisicalCredit(value, qtdInstallments, firstDueDate),
         CreditTypeEnum.Legal => new LegalCredit(value, qtdInstallments, firstDueDate),
         CreditTypeEnum.RealState => new RealStateCredit(value, qtdInstallments, firstDueDate),
         _ => throw new Exception("Nenhuma configurção para este tipo de credito")
     });
        public TransactionList GetCreditsByType(CreditTypeEnum creditType)
        {
            var data = DataStore.LoadData();

            var query = from trans in data
                        let credit = trans as Credit
                                     where credit != null && credit.CreditType == creditType
                                     orderby credit.Date, credit.Amount, credit.Description
            select credit;

            return(new TransactionList(query));
        }
Пример #4
0
        // GET: api/GetCreditsByType
        public TransactionList GetCreditsByType(CreditTypeEnum creditType)
        {
            var data = TransactionList.Load(FilePath).AsQueryable();

            return(new TransactionList(data.Where(t => (t is Credit) && (t as Credit).CreditType == creditType).ToList())); // return only transcations where credit type is included in credit type enum, sort as above
        }
Пример #5
0
        public void Create_WhenValidEnumValue_ReturnCreditOfType(CreditTypeEnum creditType, Type creditTypeof)
        {
            var result = _sut.Create(creditType, 0, 0, DateTime.Now);

            result.ShouldBeOfType(creditTypeof);
        }