Пример #1
0
        public void DataSourceRealTimeWithInternetPriceTest(Country country, string stockId)
        {
            IConfiguration config = TestServiceProvider.GetTestConfiguration();
            IStockQuoteDataSourceOperations operations = new StockQuoteDataSourceOperations();
            IStockQuoteParser      parser = new AlphaVantageParser();
            AlphaVantageDataSource source = new AlphaVantageDataSource(config, operations, parser);

            IStockQuoteFromDataSource quote = source.GetMostRecentQuoteAsync(country, stockId, WriteToErrorLogAction).Result;

            Assert.NotNull(quote);
            Assert.True(quote.IsValid);
        }
Пример #2
0
        public void DataSourceDailyFullOutputWithInternetTest(Country country, string stockId)
        {
            IConfiguration config = TestServiceProvider.GetTestConfiguration();

            DateTime start = DateTime.Now.AddDays(-600);
            DateTime end   = DateTime.Now.AddDays(-300);

            IStockQuoteDataSourceOperations operations = new StockQuoteDataSourceOperations();
            IStockQuoteParser      parser = new AlphaVantageParser();
            AlphaVantageDataSource source = new AlphaVantageDataSource(config, operations, parser);
            IReadOnlyList <IStockQuoteFromDataSource> quotes = source.GetHistoricalQuotesAsync(country, stockId, start, end, WriteToErrorLogAction).Result;

            Assert.NotNull(quotes);
            Assert.True(quotes.Count >= 206);

            foreach (IStockQuoteFromDataSource quote in quotes)
            {
                Assert.True(quote.IsValid);
            }
        }