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"); }
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); }
public void MenuParser_ParseFromXml_HandlesEmptyContent() { Action parseAction = () => MenuParser.ParseFromXml(null); parseAction.ShouldThrow <ArgumentException>(); }