示例#1
0
 public void OMF_FromRealXML_ValidObject()
 {
     var mi = new OpenMenuFormat();
       string xmlIn = Properties.Resources.alacarte_menu;
       XElement xmlElem = XElement.Load(new StringReader(xmlIn));
       mi.FromXML(xmlElem);
       Assert.AreEqual("df8cb20e-297c-11e0-91d7-0018512e6b26", mi.UUID);
       Assert.AreEqual(1, mi.Menus.Count);
       foreach (Menu menu in mi.Menus) {
     Assert.AreEqual(3, menu.Groups.Count);
     foreach (MenuGroup menuGroup in menu.Groups) {
       Assert.AreEqual(1, menuGroup.Items.Count);
     }
       }
 }
示例#2
0
 public void OMF_FromXML_ValidObject()
 {
     var mi = new OpenMenuFormat();
       string xmlIn = "<omf uuid=\"74c2b466-e360-42f0-9060-9cc7765e196a\">\r\n  <menus>\r\n    <menu uid=\"1\" name=\"alacarte\" currency_symbol=\"EUR\">\r\n      <menu_description>desc</menu_description>\r\n      <menu_groups>\r\n        <menu_group uid=\"1\" name=\"myname\">\r\n          <menu_group_description>desc</menu_group_description>\r\n          <menu_items>\r\n            <menu_item uid=\"1\">\r\n              <menu_item_name>item1</menu_item_name>\r\n              <menu_item_description>desc1</menu_item_description>\r\n              <menu_item_price>0</menu_item_price>\r\n            </menu_item>\r\n            <menu_item uid=\"2\">\r\n              <menu_item_name>item2</menu_item_name>\r\n              <menu_item_description>desc2</menu_item_description>\r\n              <menu_item_price>0</menu_item_price>\r\n            </menu_item>\r\n          </menu_items>\r\n        </menu_group>\r\n        <menu_group uid=\"2\" name=\"myname\">\r\n          <menu_group_description>desc</menu_group_description>\r\n          <menu_items>\r\n            <menu_item uid=\"1\">\r\n              <menu_item_name>item1</menu_item_name>\r\n              <menu_item_description>desc1</menu_item_description>\r\n              <menu_item_price>0</menu_item_price>\r\n            </menu_item>\r\n            <menu_item uid=\"2\">\r\n              <menu_item_name>item2</menu_item_name>\r\n              <menu_item_description>desc2</menu_item_description>\r\n              <menu_item_price>0</menu_item_price>\r\n            </menu_item>\r\n          </menu_items>\r\n        </menu_group>\r\n      </menu_groups>\r\n    </menu>\r\n  </menus>\r\n</omf>";
       XElement xmlElem = XElement.Load(new StringReader(xmlIn));
       mi.FromXML(xmlElem);
       Assert.AreEqual("74c2b466-e360-42f0-9060-9cc7765e196a", mi.UUID);
       Assert.AreEqual(1, mi.Menus.Count);
       foreach (Menu menu in mi.Menus) {
     Assert.AreEqual(2, menu.Groups.Count);
     foreach (MenuGroup menuGroup in menu.Groups) {
       Assert.AreEqual(2, menuGroup.Items.Count);
     }
       }
 }