Esempio n. 1
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);
        }