예제 #1
0
        public void TestCoffeGoodsInitializeShouldSuccess()
        {
            GoodsDataSet coffee = new GoodsDataSet();

            coffee.Initialize("goods.xml");

            XmlDocument xdoc = new XmlDocument();

            xdoc.Load("goods.xml");
            var coffeeM = xdoc.ChildNodes[0];
            var goods   = coffeeM.ChildNodes[0];

            Assert.IsNotNull(goods);
            Assert.AreEqual(4, goods.ChildNodes.Count);
            Assert.AreEqual("tea", goods.ChildNodes[0].Attributes["kind"].Value);
            Assert.AreEqual(10, Int32.Parse(goods.ChildNodes[0].Attributes["number"].Value));
            Assert.AreEqual(13, Double.Parse(goods.ChildNodes[0].Attributes["price"].Value));
            Assert.AreEqual("coffee", goods.ChildNodes[1].Attributes["kind"].Value);
            Assert.AreEqual(20, Int32.Parse(goods.ChildNodes[1].Attributes["number"].Value));
            Assert.AreEqual(18, Double.Parse(goods.ChildNodes[1].Attributes["price"].Value));
            Assert.AreEqual("cappuccino", goods.ChildNodes[2].Attributes["kind"].Value);
            Assert.AreEqual(10, Int32.Parse(goods.ChildNodes[2].Attributes["number"].Value));
            Assert.AreEqual(21, Double.Parse(goods.ChildNodes[2].Attributes["price"].Value));
            Assert.AreEqual("juice", goods.ChildNodes[3].Attributes["kind"].Value);
            Assert.AreEqual(15, Int32.Parse(goods.ChildNodes[3].Attributes["number"].Value));
            Assert.AreEqual(35, Double.Parse(goods.ChildNodes[3].Attributes["price"].Value));
        }
예제 #2
0
        public void TestCoffeGoodsInitializeShouldSuccess()
        {
            GoodsDataSet coffee = new GoodsDataSet();
            coffee.Initialize("goods.xml");

            XmlDocument xdoc = new XmlDocument();
            xdoc.Load("goods.xml");
            var coffeeM = xdoc.ChildNodes[0];
            var goods = coffeeM.ChildNodes[0];

            Assert.IsNotNull(goods);
            Assert.AreEqual(4, goods.ChildNodes.Count);
            Assert.AreEqual("tea", goods.ChildNodes[0].Attributes["kind"].Value);
            Assert.AreEqual(10, Int32.Parse(goods.ChildNodes[0].Attributes["number"].Value));
            Assert.AreEqual(13, Double.Parse(goods.ChildNodes[0].Attributes["price"].Value));
            Assert.AreEqual("coffee", goods.ChildNodes[1].Attributes["kind"].Value);
            Assert.AreEqual(20, Int32.Parse(goods.ChildNodes[1].Attributes["number"].Value));
            Assert.AreEqual(18, Double.Parse(goods.ChildNodes[1].Attributes["price"].Value));
            Assert.AreEqual("cappuccino", goods.ChildNodes[2].Attributes["kind"].Value);
            Assert.AreEqual(10, Int32.Parse(goods.ChildNodes[2].Attributes["number"].Value));
            Assert.AreEqual(21, Double.Parse(goods.ChildNodes[2].Attributes["price"].Value));
            Assert.AreEqual("juice", goods.ChildNodes[3].Attributes["kind"].Value);
            Assert.AreEqual(15, Int32.Parse(goods.ChildNodes[3].Attributes["number"].Value));
            Assert.AreEqual(35, Double.Parse(goods.ChildNodes[3].Attributes["price"].Value));
        }