예제 #1
0
        public void TestWithInccorrectCurrencyIdPeriod()
        {
            var rateService = new RateNbrbService(new Reader());

            var result = rateService.ReadCurrenciesNbrb(-17000000, new DateTime(2012, 07, 05), new DateTime(2019, 07, 05)).Result;

            Assert.IsNotNull(result);
            Assert.AreEqual(0, result.Count());
        }
예제 #2
0
        public void TestWithEmptyPeriods()
        {
            var rates      = new List <RateShortNbrb>();
            var readerMock = new Mock <IReader>();

            readerMock.Setup(s => s.HttpClientRead(It.IsAny <string>())).ReturnsAsync((string uri) => HttpClientMock(uri, rates));

            var rateService = new RateNbrbService(readerMock.Object);

            var result = rateService.ReadCurrenciesNbrb(1, new DateTime(2014, 07, 05), new DateTime(2016, 07, 05)).Result;

            Assert.IsNotNull(result);
            Assert.AreEqual(0, result.Count());
        }
예제 #3
0
        public void TestWithEmptyStartAndEndPeriod()
        {
            var rates      = Init();
            var readerMock = new Mock <IReader>();

            readerMock.Setup(s => s.HttpClientRead(It.IsAny <string>())).ReturnsAsync((string uri) => HttpClientMock(uri, rates));

            var rateService = new RateNbrbService(readerMock.Object);

            var result = rateService.ReadCurrenciesNbrb(1, new DateTime(2012, 07, 05), new DateTime(2019, 07, 05)).Result;

            Assert.IsNotNull(result);
            Assert.AreEqual(7, result.Count());
            for (int i = 0, j = 0; i < result.Count(); i++, j++)
            {
                Assert.AreEqual(rates[j].Cur_ID, result.ElementAt(i).Cur_ID);
            }
        }