Example #1
0
        public void MenuUtility_ToJson_1()
        {
            MenuFile menu   = new MenuFile();
            string   actual = menu.ToJson();

            Assert.AreEqual("[]", actual);
        }
Example #2
0
        public void MenuUtility_ToJson_2()
        {
            MenuFile menu   = _GetMenu();
            string   actual = menu.ToJson();

            Assert.AreEqual("[{\"code\":\"a\",\"comment\":\"Comment for a\"},{\"code\":\"b\",\"comment\":\"Comment for b\"},{\"code\":\"c\",\"comment\":\"Comment for c\"}]", actual);
        }
Example #3
0
        public void MenuFile_ToJson_1()
        {
            MenuFile menu = _GetMenu();

            string actual = menu.ToJson()
                            .Replace("\r", "").Replace("\n", "")
                            .Replace("\"", "'");
            string expected = "[{'code':'a','comment':'Comment for a'},{'code':'b','comment':'Comment for b'},{'code':'c','comment':'Comment for c'}]";

            Assert.AreEqual(expected, actual);
        }