Beispiel #1
0
        public void GetMainTableTest()
        {
            string[] symbols = { "LKOH", "SBER", "TATN", "ROSN", "GAZP", "MICEX" };

            var repository = new CSVMarketData("csv-market-data-2016");

            var table = repository.GetMainTable();

            Assert.AreEqual(6, table.Count);

            foreach (var item in table)
            {
                if (!symbols.Contains(item.Symbol))
                {
                    System.Diagnostics.Debug.WriteLine(item.Symbol);
                    Assert.Fail();
                }
            }
        }
Beispiel #2
0
        private void GetTest(string symbol, DateTime first, DateTime last,
                             double firstPrice, double lastPrice, int count)
        {
            var repository = new CSVMarketData("csv-market-data-2016");

            var data = repository.Get("GAZP", first, last);

            Assert.AreEqual(count, data.Count);

            Stock firstStock = data.First();

            Assert.AreEqual(first, firstStock.DateTime);
            Assert.AreEqual(firstPrice, (double)firstStock.Price);

            Stock lastStock = data.Last();

            Assert.AreEqual(last, lastStock.DateTime);
            Assert.AreEqual(lastPrice, (double)lastStock.Price);
        }