コード例 #1
0
        public void MenuParser_ParseFromXml_HandlesTopLevelElement()
        {
            var menu = MenuParser.ParseFromXml("<menu></menu>");

            menu.Should().NotBeNull();
            menu.Items.Should().HaveCount(0, "becuase there are no child elements in the xml");
        }
コード例 #2
0
ファイル: MenuTests.cs プロジェクト: mildsauce45/MenuParsing
        public void Menu_SetActive_ProperlySetsValue(string xml, string path, bool expectedResult, string reason)
        {
            var menu = MenuParser.ParseFromXml(xml);

            menu.Should().NotBeNull();

            menu.SetActive(path);

            // The call would have been successful if at least one of the top level elements is set to true
            bool result = false;

            foreach (var mi in menu.Items)
            {
                result |= mi.IsActive;
            }

            result.ShouldBeEquivalentTo(expectedResult, reason);
        }
コード例 #3
0
        public void MenuParser_ParseFromXml_HandlesEmptyContent()
        {
            Action parseAction = () => MenuParser.ParseFromXml(null);

            parseAction.ShouldThrow <ArgumentException>();
        }