示例#1
0
        public void LoadFromFileTest()
        {
            //string fileName = "Stocks.xml";
            Stocks expected = new Stocks();
            Stock  apple    = new Stock {
                Code = "APPLE", Name1 = "Apple", Name2 = "苹果"
            };
            Stock banana = new Stock {
                Code = "BANANA", Name1 = "Banana", Name2 = "香蕉", Notes = string.Empty
            };

            expected.Stock.Add(apple);
            expected.Stock.Add(banana);
            expected.SaveToFile();//fileName);

            Stocks actual = new Stocks();

            actual = actual.LoadFromFile() as Stocks;
            //todo: CollectionAssert.AreEqual(expected.Stock, actual.Stock);
            Assert.AreEqual(expected.Stock.Count, actual.Stock.Count);
        }