Exemple #1
0
        public void NationalBankDataAdapter_GetRates_IncorrectDate_Exception()
        {
            IServiceDataAdapter adapter           = _creator.CreateService();
            Exception           expectedException = Assert.Throws <Exception>(() => adapter.GetRates(_invalidContent));

            Assert.Equal("Service did not return data", expectedException.Message);
        }
Exemple #2
0
        public void NationalBankDataAdapter_GetRates_CorrectDate_Success()
        {
            IServiceDataAdapter adapter = _creator.CreateService();
            List <ServiceRate>  rates   = adapter.GetRates(_validContent);

            Assert.Equal(1, (int)GetRateValue(rates, "RUB"));
            Assert.Equal(64, (int)GetRateValue(rates, "USD"));
            Assert.Equal(2, (int)GetRateValue(rates, "UAH"));
        }
Exemple #3
0
        public void OpenExchangeRatesDataAdapter_GetRates_IncorrectDate_Exception()
        {
            IServiceDataAdapter adapter           = _creator.CreateService();
            Exception           expectedException = Assert.Throws <Exception>(() => adapter.GetRates(_invalidContent));

            Assert.Equal("Service returns message :" +
                         " Historical rates for the requested date are not available" +
                         " - please try a different date, or contact [email protected].", expectedException.Message);
        }
Exemple #4
0
        public void NationalBankDataAdapter_GetRates_CorrectDate_NoExceptions()
        {
            Exception           expectedException = null;
            IServiceDataAdapter adapter           = _creator.CreateService();

            try
            {
                adapter.GetRates(_validContent);
            }
            catch (Exception ex)
            {
                expectedException = ex;
            }
            Assert.Null(expectedException);
        }