public void MenuFile_FromJson_1() { string text = "[{'code':'a','comment':'Comment for a'},{'code':'b','comment':'Comment for b'},{'code':'c','comment':'Comment for c'}]" .Replace("'", "\""); MenuFile second = MenuUtility.FromJson(text); MenuFile first = _GetMenu(); _CompareMenu(first, second); }
public void MenuUtility_FromJson_1() { MenuFile menu = MenuUtility.FromJson("[{\"code\":\"a\",\"comment\":\"Comment for a\"},{\"code\":\"b\",\"comment\":\"Comment for b\"},{\"code\":\"c\",\"comment\":\"Comment for c\"}]"); Assert.AreEqual(3, menu.Entries.Count); Assert.AreEqual("a", menu.Entries[0].Code); Assert.AreEqual("Comment for a", menu.Entries[0].Comment); Assert.AreEqual("b", menu.Entries[1].Code); Assert.AreEqual("Comment for b", menu.Entries[1].Comment); Assert.AreEqual("c", menu.Entries[2].Code); Assert.AreEqual("Comment for c", menu.Entries[2].Comment); }