public void Create_EmptyTargetCurrency_ShouldThrowArgumentNullException() { var factory = new ExchangeChainFactory(new List <IExchangeCurrency> { new ExchangeCurrencyStub() }); Assert.IsNull(factory.Create(CURRENCY_NAME_1, string.Empty)); }
public void Create_EmptyInitialCurrency_ShouldThrowArgumentNullException() { var factory = new ExchangeChainFactory(new List <IExchangeCurrency> { new ExchangeCurrencyStub() }); Assert.IsNull(factory.Create(string.Empty, null)); }
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)); }
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); }
public void FactoryCreate_SameCurrencyTwice_ShouldReturnRightPath() { var availableExchangeCurrency = new List <IExchangeCurrency> { ExchangeCurrency.Create("AAA", "BBB", 1), ExchangeCurrency.Create("BBB", "CCC", 1), ExchangeCurrency.Create("CCC", "BBB", 1) }; var chainFactory = new ExchangeChainFactory(availableExchangeCurrency); Assert.AreEqual("AAA;BBB;CCC", chainFactory.Create("AAA", "CCC").ToString()); }
public void Create_AvailableListContainsTwoElementCanChangeWithIntermediateFinalSwitched_ChangeInvolveShouldBeEqualToTwo() { var firstExchange = CreateIntermediateExchange(CURRENCY_NAME_1, CURRENCY_NAME_2, CURRENCY_NAME_3); var secondExchange = CreateFinalExchange(CURRENCY_NAME_3, CURRENCY_NAME_2); var availableExchangeList = new List <IExchangeCurrency> { firstExchange, secondExchange }; var factory = new ExchangeChainFactory(availableExchangeList); var exchangeChain = factory.Create(CURRENCY_NAME_1, CURRENCY_NAME_3); Assert.AreEqual(2, exchangeChain.CountPartInvolve); }
public void FactoryCreate_Loop_ShouldReturnRightPath() { var availableExchangeCurrency = new List <IExchangeCurrency> { ExchangeCurrency.Create("EUR", "USD", 1), ExchangeCurrency.Create("USD", "LIV", 1), ExchangeCurrency.Create("USD", "CHF", 1), ExchangeCurrency.Create("USD", "AUD", 1), ExchangeCurrency.Create("CHF", "LIV", 1), ExchangeCurrency.Create("CHF", "AUD", 1), ExchangeCurrency.Create("CHF", "AUD", 1), ExchangeCurrency.Create("LIV", "AUD", 1), ExchangeCurrency.Create("JPY", "LIV", 1) }; var chainFactory = new ExchangeChainFactory(availableExchangeCurrency); Assert.AreEqual("EUR;USD;LIV;JPY", chainFactory.Create("EUR", "JPY").ToString()); }