예제 #1
0
        public void TestMethod1()
        {
            IEnumerable<IStockBonus> stockBonus_600036 = ExampleStockBonus_600036();//招商银行
            IEnumerable<IStockBonus> stockBonus_600518 = ExampleStockBonus_600518();//康美药业

            var repository = new StockBonusDataRepository();
            if (!repository.Exists("600036"))
            {
                foreach (var item in stockBonus_600036)
                {
                    repository.Add("600036", item);
                }
            }

            if (!repository.Exists("600518"))
            {
                foreach (var item in stockBonus_600518)
                {
                    repository.Add("600518", item);
                }
            }

            var lst_600036 = repository.GetData("600036").ToList();
            Assert.IsNotNull(lst_600036);
            Assert.IsTrue(lst_600036.Count == 5);

            var lst_600518 = repository.GetData("600518").ToList();
            Assert.IsNotNull(lst_600518);
            Assert.IsTrue(lst_600518.Count == 5);
        }
예제 #2
0
        public void TestMethod2()
        {
            var repository = new StockBonusDataRepository();

            List<string> stockCodes = new List<string>();
            stockCodes.Add("600518");//康美药业
            stockCodes.Add("600036");//招商银行
            stockCodes.Add("600298");//安琪酵母
            stockCodes.Add("601933");//永辉超市
            stockCodes.Add("600660");//福耀玻璃
            stockCodes.Add("600196");//复星医药
            stockCodes.Add("300118");//东方日升
            stockCodes.Add("000800");//一汽轿车

            var lstStockBonus = repository.GetData(stockCodes).ToList();
            Assert.IsNotNull(lstStockBonus);
            Assert.IsTrue(lstStockBonus.Count == 10);

            var lstAll = repository.GetDataAll().ToList();
            Assert.IsNotNull(lstAll);
            Assert.IsTrue(lstAll.Count == 10);
        }