예제 #1
0
        public void Change_ExchangeRatePresentButComeFromNotCorrespond_ShouldThrowNotSuportedException()
        {
            var bank         = new Bank();
            var exchangeRate = new ExchangeCurrencyStub();

            bank.AddExchangeRate(exchangeRate);

            bank.Change(null, null, 0);
        }
예제 #2
0
        public void AddExchangeRate_ExistingExchangeRate_ShouldIgnore()
        {
            var bank         = new Bank();
            var exchangeRate = new ExchangeCurrencyStub();

            bank.AddExchangeRate(exchangeRate);
            bank.AddExchangeRate(exchangeRate);

            Assert.AreEqual(1, bank.AvailableExchangeCurrency.Count);
        }
예제 #3
0
        public void Create_AvailableListCanNotChange_SouldReturnNullChain()
        {
            var availableExchangeList = new List <IExchangeCurrency>
            {
                ExchangeCurrencyStub.CreateExchangeWichCanDoNothing()
            };

            var factory = new ExchangeChainFactory(availableExchangeList);

            Assert.IsNull(factory.Create(CURRENCY_NAME_1, CURRENCY_NAME_2));
        }
예제 #4
0
        public void Change_ExchangeCurrencyPresentCanNotExchangeToTarget_ShouldThrowNotSuportedException()
        {
            var bank         = new Bank();
            var exchangeRate = new ExchangeCurrencyStub {
                CanChangeFromResult = false
            };

            bank.AddExchangeRate(exchangeRate);

            bank.Change(null, null, 0);
        }
예제 #5
0
        public void Create_AvailableListContainsOneElementCanChangeDirectly_ChangeInvolveShouldBeEqualToOne()
        {
            var availableExchangeList = new List <IExchangeCurrency>
            {
                ExchangeCurrencyStub.CreateExchangeWichManageOnlyBothCurrency()
            };

            var factory       = new ExchangeChainFactory(availableExchangeList);
            var exchangeChain = factory.Create(CURRENCY_NAME_1, CURRENCY_NAME_2);

            Assert.AreEqual(1, exchangeChain.CountPartInvolve);
        }