public IEnumerable<IStockProfile> GetAll()
        {
            StockProfileRepository repository = new StockProfileRepository(DataFiles.GetStockProfileFile());
            return repository.GetAll();

            //using (var context = GetContext())
            //{
            //    var repository = new Repository<StockProfile>(context);
            //    return repository.GetAll();
            //}
        }
Exemple #2
0
        public void TestMethod_StockProfile()
        {
            StockProfile example = ExampleStockProfile();
            string filePath = Path.Combine(Environment.CurrentDirectory, "TestStockProfile.sdf");
            if (File.Exists(filePath))
            {
                File.Delete(filePath);
            }
            StockProfileRepository repository = new StockProfileRepository(filePath);
            repository.AddRange(new IStockProfile[] { example });

            Assert.IsTrue(repository.Exists(example));
            IStockProfile get = repository.Get(example.CodeA);

            StockProfile updateData = example;
            updateData.ShortNameA = "招商银行_UpdateTest";

            repository.UpdateRange(new IStockProfile[] { updateData });
            Assert.IsTrue(repository.Exists(updateData));

            IList<IStockProfile> result = repository.GetAll().ToList();
            Assert.AreEqual(1, result.Count);
        }