public void DisplayBalance_AccountIsNull()
        {
            IRepository repository = _mocks.Stub<IRepository>();
            IAccountRepository accountRepository = _mocks.Stub<IAccountRepository>();

            AccountServices services = new AccountServices(repository, accountRepository);
            services.DisplayBalance(null, null);
        }
        public void DisplayBalance_AccountIsNotNull_DefaultCulture()
        {
            IRepository repository = _mocks.Stub<IRepository>();
            IAccountRepository accountRepository = _mocks.Stub<IAccountRepository>();

            Account account = new Account { Id = 2 };

            Expect.Call(accountRepository.GetBalance(2)).Return(1000000);

            _mocks.ReplayAll();

            AccountServices services = new AccountServices(repository, accountRepository);
            string balance = services.DisplayBalance(account, null);

            Assert.AreEqual("$1,000,000.00", balance);

            _mocks.VerifyAll();
        }
        public void DisplayBalance_AccountIsNotNull_FrenchCulture()
        {
            IRepository repository = _mocks.Stub<IRepository>();
            IAccountRepository accountRepository = _mocks.Stub<IAccountRepository>();

            Account account = new Account { Id = 2 };
            CultureInfo cultureInfo = new CultureInfo("fr-FR");

            Expect.Call(accountRepository.GetBalance(2)).Return(1000000);

            _mocks.ReplayAll();

            AccountServices services = new AccountServices(repository, accountRepository);
            string balance = services.DisplayBalance(account, cultureInfo);

            Assert.AreEqual("1 000 000,00 €", balance);

            _mocks.VerifyAll();
        }
        public void DisplayGlobalBalance_ClientHasAccounts_DefaultCulture()
        {
            IRepository repository = _mocks.Stub<IRepository>();
            IAccountRepository accountRepository = _mocks.Stub<IAccountRepository>();
            AccountServices services = new AccountServices(repository, accountRepository);

            Account account1 = new Account{Id = 4};
            Account account2 = new Account{Id = 5};
            Client client = new Client { Id = 2 , Accounts = new List<Account> { account1, account2 } };

            Expect.Call(accountRepository.GetAccountsByClient(2)).Return(client.Accounts);
            Expect.Call(accountRepository.GetBalance(4)).Return(50000);
            Expect.Call(accountRepository.GetBalance(5)).Return(30000);

            _mocks.ReplayAll();

            string globalBalance = services.DisplayGlobalBalance(client, null);

            Assert.AreEqual("$80,000.00", globalBalance);
            _mocks.VerifyAll();
        }
        public void GetClientAccounts_ClientNotNull()
        {
            IRepository repository = _mocks.Stub<IRepository>();
            IAccountRepository accountRepository = _mocks.Stub<IAccountRepository>();

            Client client = new Client { Id = 3 };
            IList<Account> accounts = new List<Account>();

            Expect.Call(accountRepository.GetAccountsByClient(3)).Return(accounts);

            _mocks.ReplayAll();

            AccountServices services = new AccountServices(repository, accountRepository);
            services.GetClientAccounts(client);

            _mocks.VerifyAll();
        }
        public void GetClientAccounts_ClientIsNull()
        {
            IRepository repository = _mocks.Stub<IRepository>();
            IAccountRepository accountRepository = _mocks.Stub<IAccountRepository>();

            AccountServices services = new AccountServices(repository, accountRepository);
            services.GetClientAccounts(null);
        }
        public void DisplayGlobalBalance_ClientHasNoAccount()
        {
            IRepository repository = _mocks.Stub<IRepository>();
            IAccountRepository accountRepository = _mocks.Stub<IAccountRepository>();
            AccountServices services = new AccountServices(repository, accountRepository);

            Account account1 = new Account();
            Account account2 = new Account();
            Client client = new Client { Accounts = new List<Account> { account1, account2 } };

            services.DisplayBalance(null, null);
        }