Exemple #1
0
        private void TestMethod()
        {
            this.factory = kernel.Get <IBankAccountFactory>();
            this.service = kernel.Get <IBankService>();

            this.service.Add(this.CreateAccount());
        }
 public BankAccountController(
     IBankAccountRepository bankAccountRepository,
     IBankAccountFactory factory
     )
 {
     _bankAccountRepository = bankAccountRepository;
     _factory = factory;
 }
 public BankAccountRepository(IBankAccountFactory factory,
                              IContextFactory <Data.Contexts.FinancialContext> dbContextFactory,
                              IBankAccountEntityFactory entityFactory)
 {
     _factory          = factory;
     _dbContextFactory = dbContextFactory;
     _entityFactory    = entityFactory;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="BankAccountMapper"/> class.
        /// </summary>
        /// <param name="bankAccountFactory">Bank accounts's factory.</param>
        public BankAccountMapper(IBankAccountFactory bankAccountFactory)
        {
            if (bankAccountFactory is null)
            {
                throw new ArgumentNullException();
            }

            this.BankAccountFactory = bankAccountFactory;
        }
Exemple #5
0
        public void AddAccountsToService(IBankAccountService bankService, IBankAccountFactory accountFactory)
        {
            BankAccount account1 = accountFactory.GetInstance(1, "Khenichi Samura", 0, 0, TypeBankAccount.Base);
            BankAccount account2 = accountFactory.GetInstance(2, "Novik Ilya", 2000, 0, TypeBankAccount.Golden);
            BankAccount account3 = accountFactory.GetInstance(3, "Robert Martin", 0, 0, TypeBankAccount.Golden);

            account3.DepositMoney(1000);

            bankService.Add(account1);
            bankService.Add(account2);
            bankService.Add(account3);

            bankService.Save();
        }
Exemple #6
0
        public void AddAccountsToService(IBankAccountService bankService, IBankAccountFactory accountFactory)
        {
            var generatorId = this.kernel.Get <IGeneratorId>();

            BankAccount account1 = accountFactory.GetInstance(generatorId.GenerateId(0), "Khenichi Samura", 0, 0, TypeBankAccount.Base);
            BankAccount account2 = accountFactory.GetInstance(generatorId.GenerateId(1), "Novik Ilya", 2000, 0, TypeBankAccount.Golden);
            BankAccount account3 = accountFactory.GetInstance(generatorId.GenerateId(2), "Robert Martin", 0, 0, TypeBankAccount.Golden);

            account3.DepositMoney(1000);

            bankService.Add(account1);
            bankService.Add(account2);
            bankService.Add(account3);

            bankService.Save();
        }
Exemple #7
0
        public void DoSomething()
        {
            this.accountFactory = kernel.Get <IBankAccountFactory>();
            this.bankService    = kernel.Get <IBankAccountService>();

            Console.WriteLine("1 - Create new bank account");
            Console.WriteLine("2 - Deposit");
            Console.WriteLine("3 - Withdraw");
            Console.WriteLine("4 - Get info about some account");
            while (true)
            {
                var choice = Console.ReadKey();
                if (ConsoleKey.D1 == choice.Key)
                {
                }
            }

            //AddAccountsToService(bankService, accountFactory);
            Console.WriteLine(bankService);
        }
 public BankAccountStorageBinary(string path, IBankAccountFactory bankAccountFactory)
 {
     this.Path = path;
     this.BankAccountFactory = bankAccountFactory;
 }
 public BankAccountService(IBankAccountRepository repository, IBankAccountFactory factory)
 {
     this.repository = repository ?? throw new ArgumentNullException($"{nameof(repository)} is null");
     this.factory    = factory ?? throw new ArgumentNullException($"{nameof(factory)} is null");
 }