Пример #1
0
        public void RemoveMethodShouldRemoveDeposit()
        {
            var dbContext = GetDatabase();

            var bank = new Bank()
            {
                Id   = 1,
                Name = "ProCredit"
            };
            var banks = new BanksService(dbContext);

            dbContext.Banks.Add(bank);
            var items = new DepositsService(dbContext, banks);

            items.Add("БНП Париба С.А.", 2000, 20000, DepositType.AdvancePaymentInterestDeposit,
                      @"В зависимост от срока и сумата:
            За срок от 12 месеца - 0.50 % ", Currency.BGN, InterestPayment.NoMatter, DepositFor.Retirees,
                      InterestType.Fixed, IncreasingAmount.No, OverdraftOpportunity.No, CreditOpportunity.No,
                      InterestCapitalize.No, "36",
                      "12", "12,24,36", ValidForCustomer.No, MonthlyAccrual.No, "няма", "няма", bank.Id, (decimal)0.1,
                      (decimal)0.3, (decimal)0.6, (decimal)0.9,
                      (decimal)1.2, (decimal)1.8, (decimal)2.4, (decimal)3.6, (decimal)4.8, (decimal)6);

            var deposit = dbContext.Deposits.FirstOrDefault();

            items.Remove(deposit.Id);
            var result = dbContext.Deposits.Count();

            Assert.AreEqual(0, result);
        }
Пример #2
0
        public void AddMethodShouldAddDeposit()
        {
            var options = new DbContextOptionsBuilder <ApplicationDbContext>()
                          .UseInMemoryDatabase(databaseName: "AddDeposit_Deposits_DB")
                          .Options;
            var dbContext = new ApplicationDbContext(options);

            var bank = new Bank()
            {
                Id   = 1,
                Name = "ProCredit"
            };
            var banks = new BanksService(dbContext);

            dbContext.Banks.Add(bank);
            var items = new DepositsService(dbContext, banks);

            items.Add("БНП Париба С.А.", 2000, 20000, DepositType.AdvancePaymentInterestDeposit,
                      @"В зависимост от срока и сумата:
            За срок от 12 месеца - 0.50 % ", Currency.BGN, InterestPayment.NoMatter, DepositFor.Retirees,
                      InterestType.Fixed, IncreasingAmount.No, OverdraftOpportunity.No, CreditOpportunity.No,
                      InterestCapitalize.No, "36",
                      "12", "12,24,36", ValidForCustomer.No, MonthlyAccrual.No, "няма", "няма", bank.Id, (decimal)0.1,
                      (decimal)0.3, (decimal)0.6, (decimal)0.9,
                      (decimal)1.2, (decimal)1.8, (decimal)2.4, (decimal)3.6, (decimal)4.8, (decimal)6);

            var result = dbContext.Deposits.Count();

            Assert.AreEqual(1, result);
        }
 public InvoiceTollTariffsController(InvoiceNumberService invoiceNumSvc, ListReleaseInvoiceService listReleaseInvoiceSvc, TemplateInvoiceService templateInvoiceSvc, CustomerService cumtomerSvc, InvoiceService invoiceSvc, BanksService banksSvc, CurrencyService currencySvc, ProductService productSvc, UnitService unitSvc)
 {
     _unitSvc = unitSvc;
     _listReleaseInvoiceSvc = listReleaseInvoiceSvc;
     _templateInvoiceSvc    = templateInvoiceSvc;
     _invoiceNumberSvc      = invoiceNumSvc;
     _cumtomerSvc           = cumtomerSvc;
     _invoiceSvc            = invoiceSvc;
     _banksSvc    = banksSvc;
     _currencySvc = currencySvc;
     _productSvc  = productSvc;
 }
Пример #4
0
 public InvoiceMarketController(InvoiceNumberService invoiceNumSvc, ListReleaseInvoiceService listReleaseInvoiceSvc, TemplateInvoiceService templateInvoiceSvc, CustomerService cumtomerSvc, InvoiceService invoiceSvc, BanksService banksSvc, CurrencyService currencySvc, ProductService productSvc, UnitService unitSvc, TransactionService transactionSvc, AccountService accountSvc)
 {
     _transactionSvc        = transactionSvc;
     _unitSvc               = unitSvc;
     _listReleaseInvoiceSvc = listReleaseInvoiceSvc;
     _templateInvoiceSvc    = templateInvoiceSvc;
     _invoiceNumberSvc      = invoiceNumSvc;
     _cumtomerSvc           = cumtomerSvc;
     _invoiceSvc            = invoiceSvc;
     _banksSvc              = banksSvc;
     _currencySvc           = currencySvc;
     _productSvc            = productSvc;
     _accountSvc            = accountSvc;
 }
        public void AddMethodShouldAddBank()
        {
            var dbContext = YourMoney.Tests.Base.BaseServiceTests.GetDatabase();

            var item = new Bank()
            {
                Name = "ProCredit"
            };

            var items = new BanksService(dbContext);

            items.Add(item.Name);
            var result = dbContext.Banks.Count();


            Assert.AreEqual(1, result);
        }
        public void EditMethodShouldEditBank()
        {
            var dbContext = YourMoney.Tests.Base.BaseServiceTests.GetDatabase();

            var item = new Bank()
            {
                Id   = 1,
                Name = "ProCredit"
            };
            var items = new BanksService(dbContext);

            items.Add(item.Name);
            items.Edit(item.Id, "DSK");

            var result = dbContext.Banks.FirstOrDefault(x => x.Name == "DSK");

            Assert.AreEqual("DSK", result.Name);
        }
Пример #7
0
        public void RemoveMethodShouldRemoveBank()
        {
            var dbContext = YourMoney.Tests.Base.BaseServiceTests.GetDatabase();

            var item = new Bank()
            {
                Id   = 1,
                Name = "ProCredit"
            };
            var items = new BanksService(dbContext);

            items.Add(item.Name);

            items.Remove(item.Id);

            var result = dbContext.Banks.FirstOrDefault();

            Assert.Null(result);
        }
Пример #8
0
        public void AddMethodShouldAddBank()
        {
            var options = new DbContextOptionsBuilder <ApplicationDbContext>()
                          .UseInMemoryDatabase(databaseName: "AddBank_Banks_DB")
                          .Options;

            var dbContext = new ApplicationDbContext(options);

            var item = new Bank()
            {
                Name = "ProCredit"
            };

            var items = new BanksService(dbContext);

            items.Add(item.Name);
            var result = dbContext.Banks.Count();


            Assert.AreEqual(1, result);
        }
Пример #9
0
        public void RemoveMethodShouldRemoveBank()
        {
            var options = new DbContextOptionsBuilder <ApplicationDbContext>()
                          .UseInMemoryDatabase(databaseName: "AddBank_Banks_DB")
                          .Options;
            var dbContext = new ApplicationDbContext(options);

            var item = new Bank()
            {
                Id   = 1,
                Name = "ProCredit"
            };
            var items = new BanksService(dbContext);

            items.Add(item.Name);

            items.Remove(item.Id);

            var result = dbContext.Banks.FirstOrDefault(b => b.Id == item.Id);

            Assert.Null(result);
        }
Пример #10
0
        public void ExistByIdMethodShouldCheckIfThereIsBankWithThatId()
        {
            var options = new DbContextOptionsBuilder <ApplicationDbContext>()
                          .UseInMemoryDatabase(databaseName: "AddBank_Banks_DB")
                          .Options;

            var dbContext = new ApplicationDbContext(options);

            var bank = new Bank()
            {
                Id   = 1,
                Name = "ProCredit"
            };

            var banksService = new BanksService(dbContext);

            banksService.Add(bank.Name);

            var result = banksService.ExistsById(bank.Id);

            Assert.True(result);
        }
Пример #11
0
        public void EditMethodShouldEditBank()
        {
            var options = new DbContextOptionsBuilder <ApplicationDbContext>()
                          .UseInMemoryDatabase(databaseName: "AddBank_Banks_DB")
                          .Options;

            var dbContext = new ApplicationDbContext(options);

            var item = new Bank()
            {
                Id   = 1,
                Name = "ProCredit"
            };

            var items = new BanksService(dbContext);

            items.Add(item.Name);
            items.Edit(item.Id, "DSK");

            var result = dbContext.Banks.FirstOrDefault(x => x.Name == "DSK");

            Assert.AreEqual("DSK", result.Name);
        }
Пример #12
0
 public BanksController(BanksService bs)
 {
     _bs = bs;
 }
Пример #13
0
 public BanksController(BanksService banksService)
 {
     BanksService = banksService;
 }
Пример #14
0
        static void Main(string[] args)
        {
            try
            {
                var accServ     = new AccountsService();
                var banksServ   = new BanksService();
                var clientsServ = new ClientsService();
                var transServ   = new TransactionsService();
                var timer       = new FutureTimer();

                var system = new BankingSystem(banksServ, clientsServ, accServ, transServ, timer);
                system.CreateBank("MyBank", 5, 500, 1000, 12);
                system.CreateBank("AnotherBank", 3, 100, 500, 6);
                system.CreateBank("TheLastButTheBest", 10, 50, 1200, 5);
                system.CreateClient("Max", "Reshetnikov", new PassportData(), "address");
                system.CreateAccount("MyBank", "Max", "Reshetnikov",
                                     AccountFactoryTypes.Credit, 1000);
                system.CreateAccount("AnotherBank", "Max", "Reshetnikov",
                                     AccountFactoryTypes.Deposit, 500);
                system.CreateAccount("TheLastButTheBest", "Max", "Reshetnikov",
                                     AccountFactoryTypes.Debit, 2000);

                var accId1 = system.GetAccId("Max", "Reshetnikov", "MyBank");
                system.PutMoney(accId1, 5000);
                Console.WriteLine(system.CheckBalance(accId1) == 6000);
                system.WithdrawMoney(accId1, 6500);
                Console.WriteLine(system.CheckBalance(accId1) == -500);
                system.GetCommission(accId1);
                Console.WriteLine(system.CheckBalance(accId1) == -1000);
                system.GetCommission(accId1);
                Console.WriteLine(system.CheckBalance(accId1) == -1000);
                var accId2 = system.GetAccId("Max", "Reshetnikov", "AnotherBank");
                system.PutMoney(accId1, 5000);
                system.TransferMoney(accId1, accId2, 2000);
                Console.WriteLine(system.CheckBalance(accId2) == 2500);

                for (var i = 0; i <= 31; ++i)
                {
                    system.PutInterestMoney(accId2);
                    system.Timer.NextDay();
                }

                Console.WriteLine(system.CheckBalance(accId2));
                var accId3 = system.GetAccId("Max", "Reshetnikov", "TheLastButTheBest");

                for (var i = 0; i <= 31; ++i)
                {
                    system.PutInterestMoney(accId3);
                    system.Timer.NextDay();
                }

                Console.WriteLine(system.CheckBalance(accId3));

                system.CreateClient("Tany", "Kolobova");
                system.CreateAccount("MyBank", "Tany", "Kolobova", AccountFactoryTypes.Credit, 2500);
                var accId4 = system.GetAccId("Tany", "Kolobova", "MyBank");
                system.WithdrawMoney(accId4, 2000);
                Console.WriteLine(system.CheckBalance(accId4) == 2500);
                system.UpdateClientsAddress("Tany", "Kolobova", "address");
                system.UpdatePassportData("Tany", "Kolobova", new PassportData());
                system.WithdrawMoney(accId4, 2000);
                Console.WriteLine(system.CheckBalance(accId4) == 500);
                system.CancelTrans(system.TransServ.GetEnumerator().Last().TransId);
                Console.WriteLine(system.CheckBalance(accId4) == 2500);
            }
            catch (BanksManagerException e)
            {
                Console.Error.WriteLine(e.Message);
            }
        }
Пример #15
0
        public IHttpActionResult GetBankList(bool onlyActive = false)
        {
            var list = BanksService.GetBanks(onlyActive);

            return(Ok(list));
        }
Пример #16
0
        public IHttpActionResult GetBank(string bankOid)
        {
            var bank = BanksService.GetBank(bankOid);

            return(Ok(bank));
        }
Пример #17
0
        public IHttpActionResult Sync()
        {
            BanksService.MasterSync();

            return(Ok());
        }
Пример #18
0
        public IHttpActionResult SaveBank(BankInfo bank)
        {
            BanksService.SaveBank(bank);

            return(Ok());
        }