public void GetDailyRatesTest()
        {
            var service = RestServiceFactory.Create();
            var rates   = service.GetDailyRates(GetValidRatesDate(), "EUR", Language.It);

            AssertValidRatesResponse(rates);
        }
        public void GetDailyRatesAsyncTest()
        {
            var service = RestServiceFactory.Create();
            var task    = service.GetDailyRatesAsync(GetValidRatesDate(), "EUR", Language.It);

            AssertTaskRatesResponse(task);
        }
        public void GetCurrenciesTest()
        {
            var service    = RestServiceFactory.Create();
            var currencies = service.GetCurrencies(Language.It);

            AssertValidCurrenciesResponse(currencies);
        }
        public void GetLatestRatesTest()
        {
            var service = RestServiceFactory.Create();
            var rates   = service.GetLatestRates(Language.It);

            AssertValidLatestRatesResponse(rates);
        }
        public void DownloadDailyRatesFileTestPdf()
        {
            var service  = RestServiceFactory.Create();
            var filePath = GetTemporaryFilePath("DownloadDailyRatesFileTest.pdf");

            service.DownloadDailyRatesFile(Model.FileFormat.Pdf, filePath, GetValidRatesDate(), "EUR", Language.It);
            AssertFile(filePath);
        }
        public void DownloadLatestRatesFileTest()
        {
            var service  = RestServiceFactory.Create();
            var filePath = GetTemporaryFilePath("DownloadLatestRatesFile.csv");

            service.DownloadLatestRatesFile(Model.FileFormat.Csv, filePath, Language.It);
            AssertFile(filePath);
        }
        public void DownloadDailyRatesFileTestXls()
        {
            var service  = RestServiceFactory.Create();
            var filePath = GetTemporaryFilePath("DownloadDailyRatesFileTest.xls");

            service.DownloadDailyRatesFile(Model.FileFormat.Xls, filePath, DateTime.Now, "EUR", Language.It);
            AssertFile(filePath);
        }
        public void DownloadDailyRatesFileAsync()
        {
            var service  = RestServiceFactory.Create();
            var filePath = GetTemporaryFilePath("DownloadDailyRatesFileTestAsync.csv");
            var task     = service.DownloadDailyRatesFileAsync(Model.FileFormat.Csv, filePath, DateTime.Now, "EUR", Language.It);

            AssertTaskDownloadFile(filePath, task);
        }
        public void RestServiceTest1()
        {
            var customEndpointBaseUrl = "http://www.google.it";
            var service = RestServiceFactory.Create(customEndpointBaseUrl);

            Assert.IsNotNull(service);
            Assert.IsTrue(customEndpointBaseUrl.Equals(service.EndpointBaseUrl));
        }
        public void GetAnnualAverageRatesAsyncTest()
        {
            var service = RestServiceFactory.Create();
            var date    = GetDateOfPreviousYear();
            var task    = service.GetAnnualAverageRatesAsync(date.Year, "EUR", Language.It);

            AssertTaskRatesResponse(task);
        }
        public void GetAnnualAverageRatesTest()
        {
            var service = RestServiceFactory.Create();
            var date    = GetDateOfPreviousYear();
            var rates   = service.GetAnnualAverageRates(date.Year, "EUR", Language.It);

            AssertValidRatesResponse(rates);
        }
        public void GetAnnualTimeSeriesAsyncTest()
        {
            var service   = RestServiceFactory.Create();
            var endDate   = GetDateOfPreviousMonth();
            var startDate = endDate.AddYears(-10);
            var task      = service.GetAnnualTimeSeriesAsync(startDate.Year, endDate.Year, "GBP", "EUR", Language.It);

            AssertTaskRatesResponse(task);
        }
        public void GetAnnualTimeSeriesTest()
        {
            var service   = RestServiceFactory.Create();
            var endDate   = GetDateOfPreviousMonth();
            var startDate = endDate.AddYears(-10);
            var rates     = service.GetAnnualTimeSeries(startDate.Year, endDate.Year, "GBP", "EUR", Language.It);

            AssertValidRatesResponse(rates);
        }
        public void DownloadAnnualAverageRatesFileAsyncTest()
        {
            var service  = RestServiceFactory.Create();
            var filePath = GetTemporaryFilePath("DownloadAnnualAverageRatesFileAsyncTest.csv");
            var date     = GetDateOfPreviousYear();
            var task     = service.DownloadAnnualAverageRatesFileAsync(Model.FileFormat.Csv, filePath, date.Year, "EUR", Language.It);

            AssertTaskDownloadFile(filePath, task);
        }
        public void DownloadMonthlyAverageRatesFileTest()
        {
            var service  = RestServiceFactory.Create();
            var filePath = GetTemporaryFilePath("DownloadMonthlyAverageRatesFileTest.csv");
            var date     = GetDateOfPreviousMonth();

            service.DownloadMonthlyAverageRatesFile(Model.FileFormat.Csv, filePath, date.Month, date.Year, "EUR", Language.It);
            AssertFile(filePath);
        }
        public void DownloadAnnualTimeSeriesFileAsyncTest()
        {
            var service   = RestServiceFactory.Create();
            var filePath  = GetTemporaryFilePath("DownloadAnnualTimeSeriesFileAsyncTest.csv");
            var endDate   = GetDateOfPreviousMonth();
            var startDate = endDate.AddYears(-10);
            var task      = service.DownloadAnnualTimeSeriesFileAsync(Model.FileFormat.Csv, filePath, startDate.Year, endDate.Year, "GBP", "EUR", Language.It);

            AssertTaskDownloadFile(filePath, task);
        }
        public void DownloadMonthlyTimeSeriesFileTest()
        {
            var service   = RestServiceFactory.Create();
            var filePath  = GetTemporaryFilePath("DownloadMonthlyTimeSeriesFileTest.csv");
            var endDate   = GetDateOfPreviousMonth();
            var startDate = endDate.AddMonths(-8);

            service.DownloadMonthlyTimeSeriesFile(Model.FileFormat.Csv, filePath, startDate.Month, startDate.Year, endDate.Month, endDate.Year, "GBP", "EUR", Language.It);
            AssertFile(filePath);
        }
        public void GetLatestRatesAsyncTest()
        {
            var service = RestServiceFactory.Create();
            var task    = service.GetLatestRatesAsync(Language.It);

            task.Wait();
            Assert.IsTrue(task.IsCompleted);
            if (task.IsCompleted)
            {
                AssertValidLatestRatesResponse(task.Result);
            }
        }
        public void RestServiceTest()
        {
            var service = RestServiceFactory.Create();

            Assert.IsNotNull(service);
        }